请问如何用delphi 模拟移动点击鼠标,
请问如何用delphi模拟移动点击鼠标,实现后台的并且要将这个delphi程序插入到需要点击的进程里...
请问如何用delphi 模拟移动点击鼠标,实现后台的 并且要将这个delphi程序插入到需要点击的进程里
展开
2013-11-28
展开全部
添加一个timer1控件+button1,将里面的代码全替换如下就可以滑笑了
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i:integer;//模拟按键时间
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Timer1.Enabled=true then
begin
i:=0;//清零
Timer1.Enabled:=false;
end
else
begin
i:=0;//清零
Timer1.Enabled:=true;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
i:=i+1;
if i mod 10=0 then
keybd_event($72,0,0,0);/哪没/$72是H键的虚拟键值,若要h健则是改信缓含为$48
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;//初始化i
Timer1.Enabled:=false;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i:integer;//模拟按键时间
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Timer1.Enabled=true then
begin
i:=0;//清零
Timer1.Enabled:=false;
end
else
begin
i:=0;//清零
Timer1.Enabled:=true;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
i:=i+1;
if i mod 10=0 then
keybd_event($72,0,0,0);/哪没/$72是H键的虚拟键值,若要h健则是改信缓含为$48
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;//初始化i
Timer1.Enabled:=false;
end;
end.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-11-28
展开全部
控制面板去设置
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询