BOOL CDemoDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_LBUTTONDOWN)
{
if(pMsg->hwnd == GetDlgItem(IDC_BUTTON1)->m_hWnd)
{
GetDlgItem(IDC_STATIC)->SetWindowText("按钮按下");
}
}
else if(pMsg->message == WM_LBUTTONUP)
{
if(pMsg->hwnd == GetDlgItem(IDC_BUTTON1)->m_hWnd)
{
GetDlgItem(IDC_STATIC)->SetWindowText("按钮抬起");
}
}
return CDialog::PreTranslateMessage(pMsg);
}
【MFC】判断按钮是按下还是弹起状态
于 2024-07-23 14:59:01 首次发布