📄 group__msg__pass__fns.htm
字号:
}</pre></div> </td> </tr></table><a class="anchor" name="ga3" doxytag="window.h::GetMessage"></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"><a class="el" href="group__simple__types.htm#ga0">BOOL</a> GetMessage </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="mdname" nowrap> <em>pMsg</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__handles.htm#ga1">HWND</a> </td> <td class="mdname" nowrap> <em>hMainWnd</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline, static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Gets a message from the message queue of a main window. <p>This function gets a message from the message queue of the main window <em>hMainWnd</em>, and returns until there is a message in the message queue.<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>Pointer to the result message. </td></tr> <tr><td valign="top"></td><td valign="top"><em>hMainWnd</em> </td><td>Handle to the window.</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>FALSE on MSG_QUIT have been found or on error, else gets a message.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga5">HavePendingMessage</a>, <a class="el" href="group__msg__pass__fns.htm#ga15">PostQuitMessage</a>, <a class="el" href="group__msg__pass__fns.htm#ga0">MSG</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); }</pre></div> <p>Definition at line <a class="el" href="window_8h-source.htm#l01933">1933</a> of file <a class="el" href="window_8h-source.htm">window.h</a>.<p>References <a class="el" href="group__msg__pass__fns.htm#ga2">PeekMessageEx()</a>, <a class="el" href="window_8h-source.htm#l01875">PM_REMOVE</a>, and <a class="el" href="common_8h-source.htm#l00262">TRUE</a>. </td> </tr></table><a class="anchor" name="ga5" doxytag="window.h::HavePendingMessage"></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"><a class="el" href="group__simple__types.htm#ga0">BOOL</a> HavePendingMessage </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__handles.htm#ga1">HWND</a> </td> <td class="mdname1" valign="top" nowrap> <em>hMainWnd</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>Checks if there is any pending message in the message queue of a main window. <p>This function checks whether there is any pending message in the message queue of the main window <em>hMainWnd</em>.<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>hMainWnd</em> </td><td>The handle to the main window.</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>TRUE for pending message, FALSE for empty message queue.</dd></dl><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#ga0">MSG</a> </dd></dl> </td> </tr></table><a class="anchor" name="ga21" doxytag="window.h::Message2Str"></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">const char *GUIAPI Message2Str </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname1" valign="top" nowrap> <em>message</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>Translates a message identifier to the message string. <p>This function returns the message string of the message identifier <em>message</em>. E.g. this function will return the string of "MSG_CHAR" for MSG_CHAR message.<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>message</em> </td><td>The message identifier. </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>The message string.</dd></dl><dl compact><dt><b>Note:</b></dt><dd>Only available if defined _MSG_STRING.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__msg__pass__fns.htm#ga22">PrintMessage</a> </dd></dl> </td> </tr></table><a class="anchor" name="ga6" doxytag="window.h::PeekMessage"></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"><a class="el" href="group__simple__types.htm#ga0">BOOL</a> PeekMessage </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="mdname" nowrap> <em>pMsg</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__handles.htm#ga1">HWND</a> </td> <td class="mdname" nowrap> <em>hWnd</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>iMsgFilterMin</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>iMsgFilterMax</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#ga6">UINT</a> </td> <td class="mdname" nowrap> <em>uRemoveMsg</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline, static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Peeks a message from the message queue of a main window. <p>This functions peek a message from the message queue of the window <em>hWnd</em> and returns immediatly. Unlike <em>GetMessage</em>, this function does not wait for a message.<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>Pointer to the result message. </td></tr> <tr><td valign="top"></td><td valign="top"><em>hWnd</em> </td><td>The handle to the window. </td></tr> <tr><td valign="top"></td><td valign="top"><em>iMsgFilterMin</em> </td><td>The min identifier of the message that should be peeked. </td></tr> <tr><td valign="top"></td><td valign="top"><em>iMsgFilterMax</em> </td><td>The max identifier of the message that should be peeked. </td></tr> <tr><td valign="top"></td><td valign="top"><em>uRemoveMsg</em> </td><td>Whether remove the message from the message queue. Should be the following values:<ul><li>PM_NOREMOVE<br> Leave it in the message queue.</li><li>PM_REMOVE Remove it from the message queue.</li><li>PM_NOYIELD Nouse now.</li></ul></td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>TRUE if there is a message peeked, or FALSE.</dd></dl><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#ga7">PeekPostMessage</a>, <a class="el" href="group__msg__pass__fns.htm#ga5">HavePendingMessage</a>, <a class="el" href="group__msg__pass__fns.htm#ga8">PostMessage</a> </dd></dl><p>Definition at line <a class="el" href="window_8h-source.htm#l01998">1998</a> of file <a class="el" href="window_8h-source.htm">window.h</a>.<p>References <a class="el" href="common_8h-source.htm#l00255">FALSE</a>, and <a class="el" href="group__msg__pass__fns.htm#ga2">PeekMessageEx()</a>. </td> </tr></table><a class="anchor" name="ga2" doxytag="window.h::PeekMessageEx"></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"><a class="el" href="group__simple__types.htm#ga0">BOOL</a> PeekMessageEx </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="mdname" nowrap> <em>pMsg</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__handles.htm#ga1">HWND</a> </td> <td class="mdname" nowrap> <em>hWnd</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>iMsgFilterMin</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>iMsgFilterMax</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__simple__types.htm#ga0">BOOL</a> </td> <td class="mdname" nowrap> <em>bWait</em>, </td> </tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -