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 wNotifyCode = HIWORD(wParam); // notification code wID = LOWORD(wParam); // item, control, or accelerator identifier hwndCtl = (HWND) lParam; // handle of control ***
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
wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam); // item, control, or accelerator identifier
hwndCtl = (HWND) lParam; // handle of control ***
wID = LOWORD(wParam); // item, control, or accelerator identifier
获得的就是控件的ID
ms-help://MS.MSDNQTR.2003FEB.2052/vclib/html/_MFCNOTES_TN006.htm
{
CString str;
str.Format("%d",wParam);
AfxMessageBox(str); //显示发送消息的ID号
return CFormView::OnCommand(wParam, lParam);
}
if (pMsg->message == WM_LBUTTONDOWN)
{
if(pMsg->hwnd == GetDlgItem(IDC_......._BUTTON)->m_hWnd)
{
....................................
}
else if(.....)
{
..........
} .................
}
else if(.....)
else if(.....)
......
这样做10个判断了恐怕得,不过我20个的都做过。
http://community.csdn.net/Expert/topic/3452/3452285.xml?temp=.1522333
有详细的步骤说明