OnCommand()

Posted Everyone is not Read-only!

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OnCommand()相关的知识,希望对你有一定的参考价值。

BOOL CXXX::OnCommand(WPARAM wParam, LPARAM lParam)
{
  if (HIWORD(wParam) == BN_CLICKED)  //判断是否是单击消息
  { switch (wParam) { case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; }
  }     return TRUE; }

CWnd::OnCommand

This method is called by the framework when the user selects an item from a menu, when a child control sends a notification message, or when an accelerator keystroke is translated.

virtual BOOL OnCommand( 
WPARAM wParam, 
LPARAM lParam );

Parameters

wParam
The low-order word of wParam identifies the command ID of the menu item, control, or accelerator. The high-order word of wParam specifies the notification message if the message is from a control. If the message is from an accelerator, the high-order word is 1. If the message is from a menu, the high-order word is 0.
lParam
Identifies the control that sends the message if the message is from a control. Otherwise, lParam is 0.

Return Value

An application returns nonzero if it processes this message; otherwise, it is zero.

 

以上是关于OnCommand()的主要内容,如果未能解决你的问题,请参考以下文章

MFC 响应控件消息

为什么我的CommandArgument为空?

关于消息传递时 this指针的问题 MFC高手进

合并功能以获得更简洁的代码?

AAuto如何设置combobox

微信小程序代码片段