📄 group__msg__pass__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: Message passing 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>Message passing functions<br><small>[<a class="el" href="group__msg__fns.htm">Message functions</a>]</small></h1><h2>Data Structures</h2><ul><li>struct <a class="el" href="struct__MSG.htm">_MSG</a></ul><h2>Defines</h2><ul><li>#define <a class="el" href="group__msg__pass__fns.htm#ga31">PM_NOREMOVE</a> 0x0000<li>#define <a class="el" href="group__msg__pass__fns.htm#ga32">PM_REMOVE</a> 0x0001<li>#define <a class="el" href="group__msg__pass__fns.htm#ga33">PM_NOYIELD</a> 0x0002</ul><h2>Typedefs</h2><ul><li>typedef <a class="el" href="struct__MSG.htm">_MSG</a> <a class="el" href="group__msg__pass__fns.htm#ga0">MSG</a></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__msg__pass__fns.htm#ga2">PeekMessageEx</a> (<a class="el" href="struct__MSG.htm">PMSG</a> pMsg, <a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsgFilterMin, int iMsgFilterMax, <a class="el" href="group__simple__types.htm#ga0">BOOL</a> bWait, <a class="el" href="group__win32__types.htm#ga6">UINT</a> uRemoveMsg)<dl class="el"><dd class="mdescRight">Peeks a message from the message queue of a main window. <a href="#ga2"></a><br></dl><li>static <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga3">GetMessage</a> (<a class="el" href="struct__MSG.htm">PMSG</a> pMsg, <a class="el" href="group__handles.htm#ga1">HWND</a> hWnd)<dl class="el"><dd class="mdescRight">Gets a message from the message queue of a main window. <a href="#ga3"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga4">WaitMessage</a> (<a class="el" href="struct__MSG.htm">PMSG</a> pMsg, <a class="el" href="group__handles.htm#ga1">HWND</a> hMainWnd)<dl class="el"><dd class="mdescRight">Waits for a message from the message queue of a main window. <a href="#ga4"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga5">HavePendingMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hMainWnd)<dl class="el"><dd class="mdescRight">Checks if there is any pending message in the message queue of a main window. <a href="#ga5"></a><br></dl><li>static <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga6">PeekMessage</a> (<a class="el" href="struct__MSG.htm">PMSG</a> pMsg, <a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsgFilterMin, int iMsgFilterMax, <a class="el" href="group__win32__types.htm#ga6">UINT</a> uRemoveMsg)<dl class="el"><dd class="mdescRight">Peeks a message from the message queue of a main window. <a href="#ga6"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga7">PeekPostMessage</a> (<a class="el" href="struct__MSG.htm">PMSG</a> pMsg, <a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsgFilterMin, int iMsgFilterMax, <a class="el" href="group__win32__types.htm#ga6">UINT</a> uRemoveMsg)<dl class="el"><dd class="mdescRight">Peeks a post message from the message queue of a main window. <a href="#ga7"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga8">PostMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Posts a message into the message queue of a window and returns immediatly. <a href="#ga8"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga9">SendMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Sends a message to a window. <a href="#ga9"></a><br></dl><li>MG_EXPORT void GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga10">SetAutoRepeatMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hwnd, int msg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Sets the auto-repeat message. <a href="#ga10"></a><br></dl><li>int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga11">PostSyncMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Posts a synchronical message to a window which is in different thread. <a href="#ga11"></a><br></dl><li>int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga12">SendAsyncMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Sends an asynchronical message to a window. <a href="#ga12"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga13">SendNotifyMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Sends a notification message to a window. <a href="#ga13"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga14">BroadcastMessage</a> (int iMsg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Broadcasts a message to all main window on the desktop. <a href="#ga14"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga15">PostQuitMessage</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hWnd)<dl class="el"><dd class="mdescRight">Puts a MSG_QUIT message into the message queue of a main window. <a href="#ga15"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga16">SetKeyboardLayout</a> (const char *kbd_layout)<dl class="el"><dd class="mdescRight">Sets a new keyboard layout. <a href="#ga16"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga17">TranslateMessage</a> (<a class="el" href="struct__MSG.htm">PMSG</a> pMsg)<dl class="el"><dd class="mdescRight">Translates key down and key up messages to MSG_CHAR message and post it into the message queue. <a href="#ga17"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga18">TranslateKeyMsgToChar</a> (int message, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam, <a class="el" href="group__win32__types.htm#ga2">WORD</a> *ch)<dl class="el"><dd class="mdescRight">Translates a key down and key up message to a corresponding character. <a href="#ga18"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga19">DispatchMessage</a> (<a class="el" href="struct__MSG.htm">PMSG</a> pMsg)<dl class="el"><dd class="mdescRight">Dispatches a message to the window's callback procedure. <a href="#ga19"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga20">ThrowAwayMessages</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> pMainWnd)<dl class="el"><dd class="mdescRight">Removes all messages in the message queue associated with a window. <a href="#ga20"></a><br></dl><li>MG_EXPORT const char *GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga21">Message2Str</a> (int message)<dl class="el"><dd class="mdescRight">Translates a message identifier to the message string. <a href="#ga21"></a><br></dl><li>MG_EXPORT void GUIAPI <a class="el" href="group__msg__pass__fns.htm#ga22">PrintMessage</a> (FILE *fp, <a class="el" href="group__handles.htm#ga1">HWND</a> hWnd, int iMsg, <a class="el" href="group__win32__types.htm#ga8">WPARAM</a> wParam, <a class="el" href="group__win32__types.htm#ga9">LPARAM</a> lParam)<dl class="el"><dd class="mdescRight">Prints a message in readable string form to a stdio stream. <a href="#ga22"></a><br></dl></ul><hr><h2>Define Documentation</h2><a class="anchor" name="ga31" doxytag="window.h::PM_NOREMOVE"></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 PM_NOREMOVE 0x0000 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga6">PeekMessage</a> <a class="el" href="group__msg__pass__fns.htm#ga2">PeekMessageEx</a> </dd></dl><p>Definition at line <a class="el" href="window_8h-source.htm#l01868">1868</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga33" doxytag="window.h::PM_NOYIELD"></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 PM_NOYIELD 0x0002 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga6">PeekMessage</a> <a class="el" href="group__msg__pass__fns.htm#ga2">PeekMessageEx</a> <a class="el" href="group__msg__pass__fns.htm#ga7">PeekPostMessage</a> </dd></dl><p>Definition at line <a class="el" href="window_8h-source.htm#l01882">1882</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga32" doxytag="window.h::PM_REMOVE"></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 PM_REMOVE 0x0001 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga6">PeekMessage</a> <a class="el" href="group__msg__pass__fns.htm#ga2">PeekMessageEx</a> <a class="el" href="group__msg__pass__fns.htm#ga7">PeekPostMessage</a> </dd></dl><p>Definition at line <a class="el" href="window_8h-source.htm#l01875">1875</a> of file <a class="el" href="window_8h-source.htm">window.h</a>.<p>Referenced by <a class="el" href="window_8h-source.htm#l01933">GetMessage()</a>. </td> </tr></table><hr><h2>Typedef Documentation</h2><a class="anchor" name="ga0" doxytag="window.h::MSG"></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">typedef struct <a class="el" href="struct__MSG.htm">_MSG</a> <a class="el" href="struct__MSG.htm">MSG</a> </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>The message structure. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga3">GetMessage</a>, <a class="el" href="group__msg__pass__fns.htm#ga8">PostMessage</a>, <a class="el" href="group__msgs.htm">Messages</a> </dd></dl> </td> </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="ga14" doxytag="window.h::BroadcastMessage"></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">int BroadcastMessage </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname" nowrap> <em>iMsg</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__win32__types.htm#ga8">WPARAM</a> </td> <td class="mdname" nowrap> <em>wParam</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__win32__types.htm#ga9">LPARAM</a> </td> <td class="mdname" nowrap> <em>lParam</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Broadcasts a message to all main window on the desktop. <p>This function posts the message specified by (<em>iMsg</em>, <em>wParam</em>, <em>lParam</em>) to all the main windows on the desktop.<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>iMsg</em> </td><td>The message identifier. </td></tr> <tr><td valign="top"></td><td valign="top"><em>wParam</em> </td><td>The first parameter of the message. </td></tr> <tr><td valign="top"></td><td valign="top"><em>lParam</em> </td><td>The second parameter of the message. </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>0 if all OK, < 0 on error.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga8">PostMessage</a> </dd></dl> </td> </tr></table><a class="anchor" name="ga19" doxytag="window.h::DispatchMessage"></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">int DispatchMessage </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct__MSG.htm">PMSG</a> </td> <td class="mdname1" valign="top" nowrap> <em>pMsg</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Dispatches a message to the window's callback procedure. <p>This function dispatches the message pointed to by <em>pMsg</em> to the target window's callback procedure.<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>pMsg</em> </td><td>The pointer to the message. </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>The return value of the message handler.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga3">GetMessage</a></dd></dl>Example:<p><div class="fragment"><pre class="fragment"><span class="comment">/*</span><span class="comment"> * A typical message loop.</span><span class="comment"> */</span> <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; 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#ga17">TranslateMessage</a> (&Msg); <a class="code" href="group__msg__pass__fns.htm#ga19">DispatchMessage</a> (&Msg);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -