📄 group__init__fns.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>MiniGUI V1.6.10 API Reference: Initialization and termination functions</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.2 --><div class="qindex"><a class="qindex" href="index.htm">Main Page</a> | <a class="qindex" href="modules.htm">Modules</a> | <a class="qindex" href="classes.htm">Alphabetical List</a> | <a class="qindex" href="annotated.htm">Data Structures</a> | <a class="qindex" href="dirs.htm">Directories</a> | <a class="qindex" href="files.htm">File List</a> | <a class="qindex" href="functions.htm">Data Fields</a> | <a class="qindex" href="globals.htm">Globals</a> | <a class="qindex" href="pages.htm">Related Pages</a></div><h1>Initialization and termination functions<br><small>[<a class="el" href="group__lite__fns.htm">MiniGUI-Processes specific functions</a>]</small></h1><h2>Defines</h2><ul><li>#define <a class="el" href="group__init__fns.htm#ga6">ReinitDesktop</a>() ReinitDesktopEx (TRUE)<dl class="el"><dd class="mdescRight">Re-initializes the desktop including the local system text. <a href="#ga6"></a><br></dl><li>#define <a class="el" href="group__init__fns.htm#ga8">MiniGUIMain</a><dl class="el"><dd class="mdescRight">The main entry of a MiniGUI application. <a href="#ga8"></a><br></dl><li>#define <a class="el" href="group__init__fns.htm#ga9">IDM_DTI_FIRST</a> (300)<dl class="el"><dd class="mdescRight">The minimum interger value of command ID when user customize desktop menu. <a href="#ga9"></a><br></dl></ul><h2>Functions</h2><ul><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__init__fns.htm#ga4">ReinitDesktopEx</a> (<a class="el" href="group__simple__types.htm#ga0">BOOL</a> init_sys_text)<dl class="el"><dd class="mdescRight">Re-initializes the desktop. <a href="#ga4"></a><br></dl><li>MG_EXPORT void GUIAPI <a class="el" href="group__init__fns.htm#ga5">ExitGUISafely</a> (int exitcode)<dl class="el"><dd class="mdescRight">Exits your MiniGUI application safely. <a href="#ga5"></a><br></dl></ul><h2>Variables</h2><ul><li>MG_EXPORT typedef void GUIAPI(* <a class="el" href="group__init__fns.htm#ga0">CustomizeDesktopMenuFunc</a> )(<a class="el" href="group__handles.htm#ga6">HMENU</a> hDesktopMenu, int iPos)<dl class="el"><dd class="mdescRight">The function pointer of customizing desktop menu function. <a href="#ga0"></a><br></dl><li>MG_EXPORT typedef int GUIAPI(* <a class="el" href="group__init__fns.htm#ga1">CustomDesktopCommandFunc</a> )(int id)<dl class="el"><dd class="mdescRight">The function pointer of customizing desktop command function. <a href="#ga1"></a><br></dl><li>MG_EXPORT <a class="el" href="group__init__fns.htm#ga0">CustomizeDesktopMenuFunc</a> <a class="el" href="group__init__fns.htm#ga2">CustomizeDesktopMenu</a><dl class="el"><dd class="mdescRight">MiniGUI default desktop menu function. <a href="#ga2"></a><br></dl><li>MG_EXPORT <a class="el" href="group__init__fns.htm#ga1">CustomDesktopCommandFunc</a> <a class="el" href="group__init__fns.htm#ga3">CustomDesktopCommand</a><dl class="el"><dd class="mdescRight">MiniGUI default desktop command function. <a href="#ga3"></a><br></dl></ul><hr><a name="_details"></a><h2>Detailed Description</h2>Normally, the only entry of any MiniGUI application is <em>MiniGUIMain</em>. The application will terminate when you call <em>exit(3)</em> or just return from <em>MiniGUIMain</em>.<p>Example 1:<p><div class="fragment"><pre class="fragment"><span class="comment">/*</span><span class="comment"> * This program parses the command line arguments.</span><span class="comment"> * If the user specified a layer name by using "-layer <layer_name", </span><span class="comment"> * the program will try to join the layer, otherwise create a new layer.</span><span class="comment"> */</span><span class="keywordtype">int</span> <a class="code" href="group__init__fns.htm#ga8">MiniGUIMain</a> (<span class="keywordtype">int</span> args, <span class="keyword">const</span> <span class="keywordtype">char</span>* arg[]){<span class="preprocessor">#ifdef _MGRM_PROCESSES</span><span class="preprocessor"></span> <span class="keywordtype">int</span> i; <span class="keyword">const</span> <span class="keywordtype">char</span>* layer = <a class="code" href="group__simple__types.htm#ga3">NULL</a>; <span class="keywordflow">for</span> (i = 1; i < args; i++) { <span class="keywordflow">if</span> (strcmp (arg[i], <span class="stringliteral">"-layer"</span>) == 0) { layer = arg[i + 1]; <span class="keywordflow">break</span>; } } <span class="keywordflow">if</span> (GetLayerInfo (layer, <a class="code" href="group__simple__types.htm#ga3">NULL</a>, <a class="code" href="group__simple__types.htm#ga3">NULL</a>, <a class="code" href="group__simple__types.htm#ga3">NULL</a>) == INV_LAYER_HANDLE) { printf (<span class="stringliteral">"GetLayerInfo: the requested layer does not exist.\n"</span>); } <span class="keywordflow">if</span> (JoinLayer (layer, arg[0], 0, 0, 0) == INV_LAYER_HANDLE) { printf (<span class="stringliteral">"JoinLayer: invalid layer handle.\n"</span>); exit (1); }<span class="preprocessor">#endif</span><span class="preprocessor"></span> ... <span class="keywordflow">return</span> 0;}</pre></div><p>Example 2:<p><div class="fragment"><pre class="fragment"><span class="comment">/*</span><span class="comment"> * This is a every simple sample for MiniGUI.</span><span class="comment"> * It will create a main window and display a string of "Hello, world!" in it.</span><span class="comment"> */</span><span class="preprocessor">#include <stdio.h></span><span class="preprocessor">#include <stdlib.h></span><span class="preprocessor">#include <string.h></span><span class="preprocessor">#include <minigui/common.h></span><span class="preprocessor">#include <minigui/minigui.h></span><span class="preprocessor">#include <minigui/gdi.h></span><span class="preprocessor">#include <minigui/window.h></span><span class="keyword">static</span> <span class="keywordtype">int</span> HelloWinProc (<a class="code" href="group__handles.htm#ga1">HWND</a> hWnd, <span class="keywordtype">int</span> message, <a class="code" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="code" href="group__win32__types.htm#ga9">LPARAM</a> lParam){ <a class="code" href="group__handles.htm#ga2">HDC</a> hdc; <span class="keywordflow">switch</span> (message) { <span class="keywordflow">case</span> <a class="code" href="group__paint__msgs.htm#ga3">MSG_PAINT</a>: hdc = <a class="code" href="group__window__general__fns.htm#ga30">BeginPaint</a> (hWnd); <a class="code" href="group__text__output__fns.htm#ga17">TextOut</a> (hdc, 0, 0, <span class="stringliteral">"Hello, world!"</span>); <a class="code" href="group__window__general__fns.htm#ga31">EndPaint</a> (hWnd, hdc); <span class="keywordflow">break</span>; <span class="keywordflow">case</span> <a class="code" href="group__creation__msgs.htm#ga7">MSG_CLOSE</a>: <a class="code" href="group__window__create__fns.htm#ga10">DestroyMainWindow</a> (hWnd); <a class="code" href="group__msg__pass__fns.htm#ga15">PostQuitMessage</a> (hWnd); <span class="keywordflow">return</span> 0; } <span class="keywordflow">return</span> <a class="code" href="group__window__create__fns.htm#ga19">DefaultMainWinProc</a>(hWnd, message, wParam, lParam);}<span class="keyword">static</span> <span class="keywordtype">void</span> InitCreateInfo (<a class="code" href="struct__MAINWINCREATE.htm">PMAINWINCREATE</a> pCreateInfo){ pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o0">dwStyle</a> = <a class="code" href="group__styles.htm#ga4">WS_CAPTION</a> | <a class="code" href="group__styles.htm#ga6">WS_VISIBLE</a>; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o1">dwExStyle</a> = 0; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o2">spCaption</a> = <span class="stringliteral">"Hello, world!"</span> ; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o3">hMenu</a> = 0; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o4">hCursor</a> = <a class="code" href="group__cursor__fns.htm#ga4">GetSystemCursor</a> (0); pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o5">hIcon</a> = 0; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o7">MainWindowProc</a> = HelloWinProc; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o8">lx</a> = 0; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o9">ty</a> = 0; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o10">rx</a> = 320; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o11">by</a> = 240; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o12">iBkColor</a> = <a class="code" href="group__color__vars.htm#ga18">PIXEL_lightwhite</a>; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o13">dwAddData</a> = 0; pCreateInfo-><a class="code" href="struct__MAINWINCREATE.htm#o6">hHosting</a> = <a class="code" href="group__window__create__fns.htm#ga15">HWND_DESKTOP</a>;}<span class="keywordtype">int</span> <a class="code" href="group__init__fns.htm#ga8">MiniGUIMain</a> (<span class="keywordtype">int</span> args, <span class="keyword">const</span> <span class="keywordtype">char</span>* arg[]){ <a class="code" href="struct__MSG.htm">MSG</a> Msg; <a class="code" href="struct__MAINWINCREATE.htm">MAINWINCREATE</a> CreateInfo; <a class="code" href="group__handles.htm#ga1">HWND</a> hMainWnd;<span class="preprocessor">#ifdef _MGRM_PROCESSES</span><span class="preprocessor"></span> JoinLayer (NAME_TOPMOST_LAYER, 0, 0, 0);<span class="preprocessor">#endif</span><span class="preprocessor"></span> InitCreateInfo (&CreateInfo); hMainWnd = <a class="code" href="group__window__create__fns.htm#ga9">CreateMainWindow</a> (&CreateInfo); <span class="keywordflow">if</span> (hMainWnd == <a class="code" href="group__window__create__fns.htm#ga17">HWND_INVALID</a>) <span class="keywordflow">return</span> -1; <span class="keywordflow">while</span> (<a class="code" href="group__msg__pass__fns.htm#ga3">GetMessage</a> (&Msg, hMainWnd)) { <a class="code" href="group__msg__pass__fns.htm#ga19">DispatchMessage</a> (&Msg); } <a class="code" href="group__window__create__fns.htm#ga8">MainWindowThreadCleanup</a> (hMainWnd); <span class="keywordflow">return</span> 0;}</pre></div> <hr><h2>Define Documentation</h2><a class="anchor" name="ga9" doxytag="minigui.h::IDM_DTI_FIRST"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define IDM_DTI_FIRST (300) </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>The minimum interger value of command ID when user customize desktop menu. <p><p>Definition at line <a class="el" href="minigui_8h-source.htm#l01437">1437</a> of file <a class="el" href="minigui_8h-source.htm">minigui.h</a>. </td> </tr></table><a class="anchor" name="ga8" doxytag="minigui.h::MiniGUIMain"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define MiniGUIMain </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p><b>Value:</b><div class="fragment"><pre class="fragment">MiniGUIAppMain (<span class="keywordtype">int</span> args, <span class="keyword">const</span> <span class="keywordtype">char</span>* argv[]); \<span class="keywordtype">int</span> main_entry (<span class="keywordtype">int</span> args, <span class="keyword">const</span> <span class="keywordtype">char</span>* argv[]) \{ \ <span class="keywordtype">int</span> iRet = 0; \ <span class="keywordflow">if</span> (<a class="code" href="minigui_8h.htm#a112">InitGUI</a> (args, argv) != 0) { \ <span class="keywordflow">return</span> 1; \ } \ iRet = MiniGUIAppMain (args, argv); \ <a class="code" href="minigui_8h.htm#a113">TerminateGUI</a> (iRet); \ <span class="keywordflow">return</span> iRet; \} \<span class="keywordtype">int</span> MiniGUIAppMain</pre></div>The main entry of a MiniGUI application. <p>This function should be defined by your application. Before Version 1.6.1, MiniGUI defines <em>main()</em> function in libminigui library for your application, and call <em><a class="el" href="group__init__fns.htm#ga8">MiniGUIMain()</a></em> in this <em>main()</em> function. The <em>main()</em> defined by MiniGUI is responsible of initializing and terminating MiniGUI.<p>After version 1.6.1, MiniGUI defines MiniGUIMain as a macro.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>args</em> </td><td>The number of arguments passed to <em>main()</em> by operating system. </td></tr> <tr><td valign="top"></td><td valign="top"><em>argv</em> </td><td>The arguments passed to <em>main()</em> by operating system.</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>The exit status will be retured to the parent process. </dd></dl><p>Definition at line <a class="el" href="minigui_8h-source.htm#l01417">1417</a> of file <a class="el" href="minigui_8h-source.htm">minigui.h</a>. </td> </tr></table><a class="anchor" name="ga6" doxytag="minigui.h::ReinitDesktop"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define ReinitDesktop </td> <td class="md" valign="top">( </td> </td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -