Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15530249
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: WINDOWS

2009-06-28 22:32:54

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;
阅读(2155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~