MCPcopy Create free account
hub / github.com/Hashiao/wuwaBackendTool / clickWindowClient

Method clickWindowClient

utils.cpp:497–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497bool Utils::clickWindowClient(HWND hwnd) {
498 if(hwnd == nullptr || !IsWindow(hwnd)){
499 return false;
500 }
501
502 QMutexLocker locker(&m_locker);
503
504 // 如果 x, y 是“客户区坐标”,则直接组合到 lParam
505 // MAKELPARAM 的低 16 位是 X 坐标,高 16 位是 Y 坐标
506 LPARAM lParam = MAKELPARAM(0, 0);
507
508 // 发送鼠标按下消息
509 PostMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam);
510 Sleep(50); // 给消息处理留一点缓冲时间
511
512 // 发送鼠标松开消息
513 PostMessage(hwnd, WM_LBUTTONUP, 0, lParam);
514 Sleep(50);
515
516 qDebug() << "Simulated click at client" ;
517
518 return true;
519}
520
521// 模拟鼠标中键点击目标窗口的客户区坐标
522bool Utils::middleClickWindowClientArea(HWND hwnd, int x, int y) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected