15,979
社区成员
发帖
与我相关
我的任务
分享
BOOL CXXXDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(WM_LBUTTONDOWN == pMsg->message)
{
CPoint pt;
GetCursorPos(&pt);
CWnd* pWnd = WindowFromPoint(pt);
if(pWnd)
{
TCHAR szName[256] = {0};
::GetClassName(pWnd->GetSafeHwnd(), szName, 256);
if(0 == _tcscmp(szName, _T("Button")))
{
int nId = pWnd->GetDlgCtrlID();
CString strText(_T(""));
strText.Format(_T("ID: %d"), nId);
AfxMessageBox(strText);
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}