鼠标自动点击的例子,模拟鼠标点击
procedure TForm1.Button1Click(Sender: TObject);
var
x,y:integer;
begin
x:= form1.Left+button2.Left+25;
y:= top+button2.Top+27;
SetCursorPos(x,y);
Mouse_Event(MOUSEEVENTF_LEFTDOWN,X,Y,0,0);
Mouse_Event(MOUSEEVENTF_LEFTUP,X,Y,0,0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
showmessage('fksj');
end;
*************************************
// Set the mouse cursor to position x,y:
SetCursorPos(x, y);
// Simulate the left mouse button down
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
// Simulate the right mouse button down
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);