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 mysql 连接

Delphi 建立快捷方式

Delphi keydown与keyup、keypress的区别

Delphi代码变异加密工具

Delphi xe10 手机内部系统相关操作(手机信息、震动、剪贴板、键盘、电话、拨号)

Delphi之截取整个窗体图片

Delphi 字符串插入与删除

Delphi中判断是否是64位操作系统

Delphi里实现对图片base64编码解码

Delphi webbrowser 加载html 将html代码转换成网页

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



打赏

取消

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

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

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

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

评论

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