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 firedac 下的 sqlite [10] - 使用 r-tree 搜索

Delphi 请求时间,为当前时间,数值为1970-01-01以来的毫秒数

Delphi获取网卡mac地址多个方法

Delphi中interface接口的使用方法

Delphi 注册表管理

Delphi 加密解密字符串函数

Delphi 取windows登录用户名

Delphi 自定义产生随机字符串函数

Delphi 禁用tedit右键菜单及复制粘贴

isleapyear:返回给定的年份是否是闰年

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



打赏

取消

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

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

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

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

评论

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