📄 group__key__msgs.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: Key event messages</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>Key event messages<br><small>[<a class="el" href="group__msgs.htm">Messages</a>]</small></h1><h2>Defines</h2><ul><li>#define <a class="el" href="group__key__msgs.htm#ga4">MSG_KEYDOWN</a> 0x0010<dl class="el"><dd class="mdescRight">User presses a key down. <a href="#ga4"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga5">MSG_CHAR</a> 0x0011<dl class="el"><dd class="mdescRight">A character translated from MSG_KEYDOWN message. <a href="#ga5"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga6">MSG_KEYUP</a> 0x0012<dl class="el"><dd class="mdescRight">User releases up a key. <a href="#ga6"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga7">MSG_SYSKEYDOWN</a> 0x0013<dl class="el"><dd class="mdescRight">User presses down a key when <Alt> key is down. <a href="#ga7"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga8">MSG_SYSCHAR</a> 0x0014<dl class="el"><dd class="mdescRight">A system character translated from MSG_SYSKEYDOWN message. <a href="#ga8"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga9">MSG_SYSKEYUP</a> 0x0015<dl class="el"><dd class="mdescRight">User releases up a key when <Alt> key is down. <a href="#ga9"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga10">MSG_KEYSYM</a> 0x0016<dl class="el"><dd class="mdescRight">A key symbol translated from MSG_KEYDOWN messages. <a href="#ga10"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga11">MSG_KEYLONGPRESS</a> 0x0017<dl class="el"><dd class="mdescRight">A key is long pressed. <a href="#ga11"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga12">MSG_KEYALWAYSPRESS</a> 0x0018<dl class="el"><dd class="mdescRight">A key is always pressed. <a href="#ga12"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga13">DEF_LPRESS_TIME</a> 500<dl class="el"><dd class="mdescRight">Default long pressed time of a key. <a href="#ga13"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga14">DEF_APRESS_TIME</a> 1000<dl class="el"><dd class="mdescRight">Default always pressed time of a key. <a href="#ga14"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga15">DEF_INTERVAL_TIME</a> 200<dl class="el"><dd class="mdescRight">Default send MSG_KEYLONGPRESS in interval value. <a href="#ga15"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga16">SetKeyLongPressTime</a>(time)<dl class="el"><dd class="mdescRight">User set default long pressed time of a key. <a href="#ga16"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga17">SetKeyAlwaysPressTime</a>(time)<dl class="el"><dd class="mdescRight">User set default always pressed time of a key. <a href="#ga17"></a><br></dl><li>#define <a class="el" href="group__key__msgs.htm#ga18">SetIntervalTime</a>(time)<dl class="el"><dd class="mdescRight">User set default interval time that MSG_KEYLONGPRESS is sent. <a href="#ga18"></a><br></dl></ul><hr><h2>Define Documentation</h2><a class="anchor" name="ga14" doxytag="window.h::DEF_APRESS_TIME"></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 DEF_APRESS_TIME 1000 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Default always pressed time of a key. <p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__key__msgs.htm#ga12">MSG_KEYALWAYSPRESS</a> </dd></dl><p>Definition at line <a class="el" href="window_8h-source.htm#l00554">554</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga15" doxytag="window.h::DEF_INTERVAL_TIME"></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 DEF_INTERVAL_TIME 200 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Default send MSG_KEYLONGPRESS in interval value. <p><p>Definition at line <a class="el" href="window_8h-source.htm#l00560">560</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga13" doxytag="window.h::DEF_LPRESS_TIME"></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 DEF_LPRESS_TIME 500 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Default long pressed time of a key. <p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__key__msgs.htm#ga11">MSG_KEYLONGPRESS</a> </dd></dl><p>Definition at line <a class="el" href="window_8h-source.htm#l00546">546</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga5" doxytag="window.h::MSG_CHAR"></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 MSG_CHAR 0x0011 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>A character translated from MSG_KEYDOWN message. <p>This message is translated from a MSG_KEYDOWN message by <em>TranslateMessage</em> and sent to the current active window.<p><div class="fragment"><pre class="fragment"> <a class="code" href="group__key__msgs.htm#ga5">MSG_CHAR</a> <span class="keywordtype">int</span> ch = (int)wParam; <a class="code" href="group__win32__types.htm#ga4">DWORD</a> key_flags = (<a class="code" href="group__win32__types.htm#ga4">DWORD</a>)lParam;</pre></div><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>ch</em> </td><td>The ASCII code of the pressed key. </td></tr> <tr><td valign="top"></td><td valign="top"><em>key_flags</em> </td><td>The shift key status when this message occurred.</td></tr> </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__key__msgs.htm#ga8">MSG_SYSCHAR</a>, <a class="el" href="group__msg__pass__fns.htm#ga17">TranslateMessage</a>, <a class="el" href="group__key__defs.htm">Macros for key codes and shift status</a> </dd></dl><p>Definition at line <a class="el" href="window_8h-source.htm#l00411">411</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga12" doxytag="window.h::MSG_KEYALWAYSPRESS"></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 MSG_KEYALWAYSPRESS 0x0018 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>A key is always pressed. <p>This message is sent when a key is pressed to exceed user-defined always time value. <p>Definition at line <a class="el" href="window_8h-source.htm#l00538">538</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga4" doxytag="window.h::MSG_KEYDOWN"></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 MSG_KEYDOWN 0x0010 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>User presses a key down. <p>This message is posted to the current active window when the user presses a key down.<p><div class="fragment"><pre class="fragment"> <a class="code" href="group__key__msgs.htm#ga4">MSG_KEYDOWN</a> <span class="keywordtype">int</span> scancode = (int)wParam; <a class="code" href="group__win32__types.htm#ga4">DWORD</a> key_flags = (<a class="code" href="group__win32__types.htm#ga4">DWORD</a>)lParam;</pre></div><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>scancode</em> </td><td>The scan code of the pressed key. </td></tr> <tr><td valign="top"></td><td valign="top"><em>key_flags</em> </td><td>The shift key status when this message occurred.</td></tr> </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__key__msgs.htm#ga6">MSG_KEYUP</a>, <a class="el" href="group__key__defs.htm">Macros for key codes and shift status</a></dd></dl>Example:<p><div class="fragment"><pre class="fragment"><span class="comment">/*</span><span class="comment"> * This example trys to handle the event when the user</span><span class="comment"> * presses <C> key as the <Ctrl> key is down.</span><span class="comment"> */</span><span class="keywordtype">int</span> MyWinProc (<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){ <span class="keywordflow">switch</span> (message) { <span class="keywordflow">case</span> <a class="code" href="group__key__msgs.htm#ga4">MSG_KEYDOWN</a>: <span class="keywordflow">if</span> (wParam ==SCANCODE_C && lParam & <a class="code" href="group__key__defs.htm#ga133">KS_CTRL</a>) { <span class="comment">// User pressed Ctrl+C.</span> <span class="keywordflow">break</span>; } <span class="keywordflow">break</span>; ... } <span class="keywordflow">return</span> <a class="code" href="group__window__create__fns.htm#ga19">DefaultMainWinProc</a> (hWnd, message, wParam, lParam);}</pre></div> <p>Definition at line <a class="el" href="window_8h-source.htm#l00391">391</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga11" doxytag="window.h::MSG_KEYLONGPRESS"></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 MSG_KEYLONGPRESS 0x0017 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>A key is long pressed. <p>This message is sent when a key is pressed exceed user-defined long time value. <p>Definition at line <a class="el" href="window_8h-source.htm#l00529">529</a> of file <a class="el" href="window_8h-source.htm">window.h</a>. </td> </tr></table><a class="anchor" name="ga10" doxytag="window.h::MSG_KEYSYM"></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 MSG_KEYSYM 0x0016 </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>A key symbol translated from MSG_KEYDOWN messages. <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -