WM_COMMAND

王朝百科·作者佚名  2010-04-22
窄屏简体版  字體: |||超大  

TheWM_COMMANDmessage 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.

A window receives this message through itsWindowProcfunction.

LRESULT CALLBACK WindowProc( HWNDhwnd,// handle to window UINTuMsg,// WM_COMMAND WPARAMwParam,// notification code and identifier LPARAMlParam// handle to control (HWND));

ParameterswParamThe high-order word specifies the notification code if the message is from a control. If the message is from an accelerator, this value is 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.

lParamHandle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL. Return ValuesIf an application processes this message, it should return zero.

RemarksAccelerator keystrokes that select items from the window menu are translated intoWM_SYSCOMMANDmessages.

If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, noWM_COMMANDmessage is sent. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, aWM_COMMANDmessage is sent, even if the window is minimized.

If an application enables a menu separator, the system sends aWM_COMMANDmessage with the low-word of thewParamparameter set to zero when the user selects the separator.

Windows 98, Windows 2000:If a menu is defined with aMENUINFO.dwStylevalue of MNS_NOTIFYBYPOS,WM_MENUCOMMANDis sent instead ofWM_COMMAND.

RequirementsWindows NT/2000:Requires Windows NT 3.1 or later.

Windows 95/98:Requires Windows 95 or later.

Header:Declared in Winuser.h; include Windows.h.

See AlsoMenus Overview, Menu Messages,HIWORD,LOWORD,MENUINFO,WM_MENUCOMMAND,WM_SYSCOMMAND

WM_COMMAND(上文翻译)

TheWM_COMMANDmessage 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 itsWindowProcfunction.

窗口通过WindowProc函数收到此消息。

LRESULT CALLBACK WindowProc( HWNDhwnd,// handle to window UINTuMsg,// WM_COMMAND WPARAMwParam,// notification code and identifier LPARAMlParam// handle to control (HWND));

LRESULT CALLBACK WindowProc( HWNDhwnd,// 窗口句柄

UINTuMsg,// WM_COMMAND

WPARAMwParam,// notification code and identifier 消息

LPARAMlParam// handle to control (HWND) 控件id

);

ParameterswParamThe 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.低命令字的标识符指定的菜单项,控制或加速器。

lParamHandle 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 intoWM_SYSCOMMANDmessages. RemarksAccelerator击键的选择项目从窗口菜单化为WM_SYSCOMMAND消息。

If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, noWM_COMMANDmessage 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, aWM_COMMANDmessage is sent, even if the window is minimized.但是,如果出现一个加速器按键不匹配的任何物品在窗口的菜单或窗口菜单,一个WM_COMMAND消息发送,即使是最小化的窗口。

If an application enables a menu separator, the system sends aWM_COMMANDmessage with the low-word of thewParamparameter set to zero when the user selects the separator.如果应用程序使菜单分离,系统发出了一个WM_COMMAND消息的低字的wParam参数设置为0时,用户选择的分隔符。

Windows 98, Windows 2000:If a menu is defined with aMENUINFO.dwStylevalue of MNS_NOTIFYBYPOS,WM_MENUCOMMANDis sent instead ofWM_COMMAND.Windows 98中, Windows 2000中:如果一个菜单的定义与MENUINFO.dwStyle价值MNS_NOTIFYBYPOS ,WM_MENUCOMMAND发送不是WM_COMMAND。

RequirementsWindows 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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航