词条 | WM_COMMAND |
释义 | win32用法WM_COMMAND: 窗口菜单: LOWORD(wParam): 菜单id HIWORD(wParam): 0 lParam: 0 如果这个消息是由子窗口控件产生,如button产生则: LOWORD(wParam): 控件ID HIWORD(wParam): 通知码 lParam: 子窗口句柄。 如果这个消息是由子窗口或者快捷键产生则通知码为1,由菜单产生通知码为0。 通过参数,可以区分这个消息的来源是来自于控件,快捷键还是菜单。 MSDN解释WM_COMMAND (上文翻译) The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated. 当用户从菜单选中一个命令项目、当一个控件发送通知消息给去父窗口或者按下一个快捷键将发送 WM_COMMAND 消息 A window receives this message through its WindowProc function. 窗口通过WindowProc函数收到此消息。 LRESULT CALLBACK WindowProc( HWND hwnd // handle to window UINT uMsg // WM_COMMAND WPARAM wParam // notification code and identifier LPARAM lParam // handle to control (HWND) ); LRESULT CALLBACK WindowProc( HWND hwnd // 窗口句柄 UINT uMsg // WM_COMMAND WPARAM wParam // notification code and identifier 消息 LPARAM lParam // handle to control (HWND) 控件id ); Parameters wParam The high-order word specifies the notification code if the message is from a control.如果信息是从控件传来,参数wParam高位字指定通知代码。 If the message is from an accelerator, this value is 1.如果信息是从一个加速器传来,这个值是1 。 If the message is from a menu, this value is zero. 如果信息是从菜单中传来,这个值是零。 The low-order word specifies the identifier of the menu item, control, or accelerator.低位字的标识符指定的菜单项,控件或加速器。 lParam Handle to the control sending the message if the message is from a control. lParam如果信息是从控件传来,句柄控制传送信息。 Otherwise, this parameter is NULL.否则,这个参数是无效的。 Return ValuesIf an application processes this message, it should return zero. 返回ValuesIf应用程序这个讯息,它应返回零。 RemarksAccelerator keystrokes that select items from the window menu are translated into WM_SYSCOMMAND messages. RemarksAccelerator击键的选择项目从窗口菜单化为WM_SYSCOMMAND消息。 If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, no WM_COMMAND message is sent.如果出现一个加速器按键对应的菜单项时的窗口,拥有菜单最小,没有WM_COMMAND发送邮件。 However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, a WM_COMMAND message is sent, even if the window is minimized.但是,如果出现一个加速器按键不匹配的任何物品在窗口的菜单或窗口菜单,一个WM_COMMAND消息发送,即使是最小化的窗口。 If an application enables a menu separator, the system sends a WM_COMMAND message with the low-word of the wParam parameter set to zero when the user selects the separator.如果应用程序使菜单分离,系统发出了一个WM_COMMAND消息的低字的wParam参数设置为0时,用户选择的分隔符。 Windows 98, Windows 2000: If a menu is defined with a MENUINFO.dwStyle value of MNS_NOTIFYBYPOS, WM_MENUCOMMAND is sent instead of WM_COMMAND . Windows 98中, Windows 2000中:如果一个菜单的定义与MENUINFO.dwStyle价值MNS_NOTIFYBYPOS , WM_MENUCOMMAND发送不是WM_COMMAND 。 Requirements Windows NT/2000: Requires Windows NT 3.1 or later.要求视窗 NT/2000 :需要Windows NT 3.1或更高版本。 Windows 95/98: Requires Windows 95 or later. 视窗95/98 :需要Windows 95或更新版本。 Header: Declared in Winuser.h; include Windows.h. 标题:中宣布的Winuser.h ;包括Windows.h 。 See AlsoMenus Overview, Menu Messages, HIWORD , LOWORD , MENUINFO , WM_MENUCOMMAND , WM_SYSCOMMAND查看AlsoMenus概况,菜单消息, HIWORD , LOWORD , MENUINFO , WM_MENUCOMMAND , WM_SYSCOMMAND |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。