直接处理 对话框WM_COMMAND消息 BOOL CEDITDlg::OnCommand(WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class WORD wNotifyCode = HIWORD(wParam); // notification code WORD wID = LOWORD(wParam); // item, control, or accelerator identifier HWND hwndCtl = (HWND) lParam; // handle of control
switch ( wNotifyCode ) { case EN_SETFOCUS: { if (wID == IDC_EDIT1 ) TRACE("IDC_EDIT1\n"); if (wID == IDC_EDIT2 ) TRACE("IDC_EDIT2\n"); } break; }
m_edit1.m_hWnd == ::GetFocus()
还是要灰常感谢各位的
BOOL CEDITDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
WORD wNotifyCode = HIWORD(wParam); // notification code
WORD wID = LOWORD(wParam); // item, control, or accelerator identifier
HWND hwndCtl = (HWND) lParam; // handle of control
switch ( wNotifyCode )
{
case EN_SETFOCUS:
{
if (wID == IDC_EDIT1 )
TRACE("IDC_EDIT1\n");
if (wID == IDC_EDIT2 )
TRACE("IDC_EDIT2\n");
}
break;
}
return CDialog::OnCommand(wParam, lParam);
}