📄 splash.c
字号:
#include <stdio.h>#include <stdlib.h>#include <time.h>#include <string.h>#include <sys/time.h>#include <pthread.h>#include <semaphore.h>#include <unistd.h>#include <dirent.h>#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>#include "vacs.h"#include "gui.h"#include "splash.h"#define IDC_INITINFO 100static DLGTEMPLATE DlgSplashInfo = { WS_BORDER | WS_VISIBLE, WS_EX_NONE, 150, 145, 500, 340, "Splash", 0, 0, 1, NULL};static CTRLDATA CtrlSplashInfo [] = { { "static", WS_VISIBLE | SS_LEFT, 0, 315, 500, 20, IDC_INITINFO, " No information now ...", 0 }};static intDialogSplashInfoProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam){ static BITMAP bmpSplash; switch (message) { case MSG_CREATE: { char pathname [PATH_MAX + 1]; LoadBitmap ( HDC_SCREEN, &bmpSplash, GetAbsolutePathName("res/vacs3.bmp", pathname)); break; } case MSG_PAINT: { HDC hdc; hdc = BeginPaint (hWnd); FillBoxWithBitmap (hdc, 0, 0, 0, 0, &bmpSplash); EndPaint(hWnd, hdc); return 0; } case MSG_CLOSE: UnloadBitmap (&bmpSplash); DestroyAllControls (hWnd); DestroyMainWindow (hWnd); return 0; } return DefaultMainWinProc (hWnd, message, wParam, lParam);}static HWND SplashInfoDialogBox (){ DlgSplashInfo.controls = CtrlSplashInfo; return CreateMainWindowIndirect (&DlgSplashInfo, HWND_DESKTOP, DialogSplashInfoProc);}/****************************** Interfaces ************************************/int GlobalInit (){ int rc; HWND hSplash; time_t start_t; int interval; hSplash = SplashInfoDialogBox (); if (hSplash == HWND_INVALID) return VACS_ERROR_GUI; UpdateWindow (hSplash, TRUE); start_t = time (NULL); rc = InitHeader (hSplash); if (rc) goto error; rc = InitFooter (hSplash); if (rc) goto error; SetSplashInfo(hSplash, "初始化完成。欢迎使用 VACSIII 虚拟轴机床数控系统!"); interval = SPLASH_WAIT_TIME - (int)(time (NULL) - start_t); if (interval > 0) sleep (interval); SendMessage (hSplash, MSG_CLOSE, 0, 0); return VACS_OK;error: fprintf (stderr, "\nInitialization error: %d.\n", rc); SendMessage (hSplash, MSG_CLOSE, 0, 0); return rc;}void GlobalCleanUp (){ FooterCleanUp (); HeaderCleanUp ();}void SetSplashInfo(HWND hWnd, char* szText){ SetWindowText (GetDlgItem (hWnd, IDC_INITINFO), szText); while (HavePendingMessage (hWnd)) { MSG msg; GetMessage (&msg, hWnd); DispatchMessage (&msg); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -