如果写了一个CStatic继承类,如果在主对话框上直接new一个CStatic 后,子类里面的PreTranslateMessage不响应class CMyStatic : public CStatic
{ virtual BOOL PreTranslateMessage(MSG* pMsg);
}BOOL CMyStatic::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONUP)
{ PostMessage(WM_BUTTONPRESSED,(WPARAM)pMsg->hwnd,0);
}
return CStatic::PreTranslateMessage(pMsg);
}
//主对话框
 void CMaindDlg::OnTest()
{
m_static =new CMyStatic();
m_static->Create("",WS_CHILD|WS_VISIBLE|SS_NOTIFY,CRect(200,0,400,200),this,0x15);
m_static->ShowWindow(SW_SHOW);}
子类里面里面不响应PreTranslateMessage