试试 void CCancelModeDlg::OnSetfocusEdit1() { // TODO: Add your control notification handler code here if(!FindWindow(0,"xxx")) { ::MessageBox(m_Edit1.m_hWnd,"SetfocusEdit1","xxx",MB_OK); m_Edit1.PostMessage(WM_CANCELMODE,0,0); } }