你的位置:首页 > 操作系统

[操作系统]VC++模拟一次鼠标点击返回原位置

 HWND h; RECT r1; POINT p;//x,yvoid 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);}