判断按钮的点击和抬起

    xiaoxiao2021-12-12  8

    在父窗口的PretranslateMessage中拦截WM_LBUTTONDOWN和WM_LBUTTONUP进行处理: C/C++ code ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 BOOL  CTestDlg::PreTranslateMessage(MSG* pMsg)  {      if (pMsg->message == WM_LBUTTONDOWN)      {          if (pMsg->hwnd == GetDlgItem(IDC_BUTTON1)->m_hWnd)          {                      // 按钮按下                  }      }      else  if (pMsg->message == WM_LBUTTONUP)      {          if (pMsg->hwnd == GetDlgItem(IDC_BUTTON1)->m_hWnd)          {                      // 按钮弹起                  }      }        return  CDialog::PreTranslateMessage(pMsg); } 
    转载请注明原文地址: https://ju.6miu.com/read-900066.html

    最新回复(0)