Example 1:
/* * This program parses the command line arguments. * If the user specified a layer name by using "-layer <layer_name", * the program will try to join the layer, otherwise create a new layer. */ int MiniGUIMain (int args, const char* arg[]) { #ifdef _LITE_VERSION int i; const char* layer = NULL; RECT max_rect = {0, 0, 0, 0}; for (i = 1; i < args; i++) { if (strcmp (arg[i], "-layer") == 0) { layer = arg[i + 1]; break; } } GetLayerInfo (layer, &max_rect, NULL, NULL, NULL); if (JoinLayer (layer, arg[0], max_rect.left, max_rect.top, max_rect.left + DEFAULT_WIDTH, max_rect.top + DEFAULT_HEIGHT) == INV_LAYER_HANDLE) { printf ("JoinLayer: invalid layer handle.\n"); exit (1); } #endif ... return 0; }
Example 2:
/* * This is a every simple sample for MiniGUI. * It will create a main window and display a string of "Hello, world!" in it. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <minigui/common.h> #include <minigui/minigui.h> #include <minigui/gdi.h> #include <minigui/window.h> static int HelloWinProc (HWND hWnd, int 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 _LITE_VERSION SetDesktopRect (0, 0, 800, 600); #endif InitCreateInfo (&CreateInfo); hMainWnd = CreateMainWindow (&CreateInfo); if (hMainWnd == HWND_INVALID) return -1; while (GetMessage (&Msg, hMainWnd)) { DispatchMessage (&Msg); } MainWindowThreadCleanup (hMainWnd); return 0; } #ifndef _LITE_VERSION #include <minigui/dti.c> #endif
|
|
The minimum interger value of command ID when user customize desktop menu.
|
|
|
Value: MiniGUIAppMain (int args, const char* argv[]); \ int main_entry (int args, const char* argv[]) \ { \ int iRet = 0; \ if (InitGUI (args, argv) != 0) { \ return 1; \ } \ iRet = MiniGUIAppMain (args, argv); \ TerminateGUI (iRet); \ return iRet; \ } \ int MiniGUIAppMain This function should be defined by your application. Before Version 1.6.1, MiniGUI defines main() function in libminigui library for your application, and call MiniGUIMain() in this main() function. The main() defined by MiniGUI is responsible of initializing and terminating MiniGUI. After version 1.6.1, MiniGUI defines MiniGUIMain as a macro.
|
|
|
Re-initializes the desktop including the local system text.
|
|
|
Exits your MiniGUI application safely. Calling this function will terminate your MiniGUI application. This function will restore console attributes and call exit() function and pass exitcode to it.
|
|
|
Re-initializes the desktop. When you changed the charset or the background picture of the desktop, you should call this function to re-initialize the local system text (when init_sys_text is TRUE), the background picture, and the desktop menu.
|
1.4.2