请问下Oncommnd消息和msg structure的区别
MSG Structure是这么定义的
The MSG structure has the following form:
typedef struct tagMSG { // msg
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
当我重载
BOOL CXXXXXDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDOWN)
{
if(pMsg->hwnd == ((CWnd*)GetDlgItem(IDC_BTDOME_01))->m_hWnd)
处理;
}}
可以根据Id来判断控件
但是这样为什么不行呢
BOOL CXXXXXDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDOWN)
{
if(LOWORD(pMsg->wparam) == IDC_BTDOME_01)
处理;
}}
用Oncommnd却可以根据wparam判断id