var screen_x:integer=0;
screen_y:integer=0;
mouse_x,mouse_y:integer;
procedure TForm1.Button1Click(Sender: TObject);
begin
mouse_x := 300;
mouse_y := 300;
mouse_event(MOUSEEVENTF_MOVE or MOUSEEVENTF_ABSOLUTE ,
(mouse_x * 65535) div screen_x ,
(mouse_y * 65535) div screen_y ,
0,0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
SetCursorPos(300,300);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
SetCursorPos(300,300);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
SetCursorPos(300,300);
mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
screen_x:=screen.Width;
screen_y:=screen.Height;
form1.Caption := inttostr(screen_x) + '×' + inttostr(screen_y) + '像素';
end;
阅读(2149) | 评论(0) | 转发(0) |