Delphi 控制鼠标按坐标点击


本文整理自网络,侵删。

 

procedure DoIdle(XMsSec: Cardinal);
var
  ElapsedTime: Cardinal;
begin
  ElapsedTime := 0;
  while ElapsedTime < XMsSec do
  begin
    Application.ProcessMessages;
    Sleep(10);
    Inc(ElapsedTime, 10);
  end;

end;


procedure MoniClick(X, Y: Integer);
var
  LCount: Integer;
begin
  LCount := 0;
  while not SetCursorPos(X, Y) do
  begin
    Inc(LCount);
    if LCount > 100 then
      Exit;
  end;

  DoIdle(100);
  mouse_event(MOUSEEVENTF_LEFTDOWN, 0,0,0,GetMessageExtraInfo());
  DoIdle(100);
  mouse_event(MOUSEEVENTF_LEFTUP, 0,0,0,GetMessageExtraInfo());

end;

相关阅读 >>

Delphi shellexecute打开文件另类用法

Delphi serial number of an usb flash drive 获取u盘硬件序列号

Delphi strtofloat 将“字符型”转换成“浮点型”

Delphi idsmtp发送邮件的问题

Delphi ado连接数据库

Delphi防止因系统崩溃而丢失任务栏的图标(重建托盘图标)

Delphi 调用win32 api操作串口

Delphi httpget 判断链接是否可以访问

Delphi 延时的4种方法

Delphi 几个实用的html解析函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...