模拟鼠标怎么在后台运行?
就是比如一个窗口是最小化的,但要通过鼠标来点击(200,100)这个位置,该如何实现了?窗口是最小化的.
查了API(SetCursorPos)这个好想不能最小化的。
[解决办法]
//试试
procedure TForm1.Button1Click(Sender: TObject);
var
xxxRect: TRect;
Temp:HWND;
procedure xxClicked(x, y: integer);
begin
PostMessage(Temp, WM_LBUTTONDOWN, MK_LBUTTON, x + y shl 16);
PostMessage(Temp, WM_LBUTTONUP, MK_LBUTTON, x + y shl 16);
end;
begin
Temp := findwindow(nil,pchar( '测试测试测试 '));
GetWindowRect(Temp, xxxRect);
with xxxRect do xxClicked(100,200);
end;