/* * This is a every simple sample for MiniGUI. * It will create a main window and display a string of "Hello, world!" in it. */ #include #include #include #include #include #include #include static LRESULT HelloWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; switch (message) { case MSG_PAINT: hdc = BeginPaint (hWnd); TextOut (hdc, 0, 0, "Hello, world!"); EndPaint (hWnd, hdc); break; case MSG_CLOSE: DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam); } static void InitCreateInfo (PMAINWINCREATE pCreateInfo) { pCreateInfo->dwStyle = WS_CAPTION | WS_VISIBLE; pCreateInfo->dwExStyle = 0; pCreateInfo->spCaption = "Hello, world!" ; pCreateInfo->hMenu = 0; pCreateInfo->hCursor = GetSystemCursor (0); pCreateInfo->hIcon = 0; pCreateInfo->MainWindowProc = HelloWinProc; pCreateInfo->lx = 0; pCreateInfo->ty = 0; pCreateInfo->rx = 320; pCreateInfo->by = 240; pCreateInfo->iBkColor = PIXEL_lightwhite; pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } int MiniGUIMain (int args, const char* arg[]) { MSG Msg; MAINWINCREATE CreateInfo; HWND hMainWnd; #ifdef _MGRM_PROCESSES JoinLayer (NAME_DEF_LAYER, arg[0], 0, 0); #endif InitCreateInfo (&CreateInfo); hMainWnd = CreateMainWindow (&CreateInfo); if (hMainWnd == HWND_INVALID) return -1; while (GetMessage (&Msg, hMainWnd)) { DispatchMessage (&Msg); } MainWindowThreadCleanup (hMainWnd); return 0; }