HWND h; RECT r1; POINT p;//x,y void ONCE() { h=::FindWindow(NULL,"biaoti"); ::GetWindowRect(h,&r1); //保存当前鼠标指针 //取得当前鼠标位置 GetCursorPos(&p); //设置鼠标指针位置 取坐标:x=273;y=273 //lparam 0x01110111 SetCursorPos(273+r1.left,273+r1.top); //按下 mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); //抬起 mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); //还原 Sleep(200); SetCursorPos(p.x,p.y); }
时间: 2024-10-01 04:51:45