MFC 发送模拟双击消息
程序员文章站
2024-02-08 17:39:16
...
1、用PostMessage
CRect rect;
CWnd *pwnd = (CWnd *)GetDlgItem(IDC_BUTTON2);
pwnd->GetWindowRect(rect);
SetCursorPos(rect.left+5, rect.top+5);
::PostMessage(this->m_hWnd, WM_COMMAND, MAKEWPARAM(IDC_BUTTON2, BN_DOUBLECLICKED)
, NULL);//MAKELPARAM(rect.left+5, rect.top+5) //根据不同消息来设置 LPARAM 防止奔溃