delphi查找程序坐标 获取鼠标 模拟鼠标


本文整理自网络,侵删。

 使用 API FindWindow 指定IE 窗口的Class类别,及窗口的标题文本, 将返回该窗口的句柄, 通过 API GetWindowRect 函数可以得到该窗口坐标位置注意,Delphi 也应该事先声明这些API 吧?
----------------获取指定程序位置
var
h:hwnd;
rt:TRect;
begin
h:=findwindow(nil,'计算器');
if h<>0 then
begin
    GetWindowRect(h,rt);
    showmessage(inttostr(rt.Left)+#13+inttostr(rt.top)); //左侧位置 
end;
end;
----------------获取鼠标位置
procedure TForm1.FormClick(Sender: TObject);
var
P: TPoint;
begin
GetCursorPos(P);
Self.Caption := Format('X: %d, Y: %d',[P.X, P.Y]);
end; 
-----------------移动鼠标-模拟单击操作
SetCursorPos(10,10);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);

相关阅读 >>

Delphi fdconnection1 获取数据库总记录数

Delphi idhttp登录网站教程代码

Delphi unigui中如何监听session的开始与结束

Delphi模拟点击网页中的按钮

Delphi getwebbrowserhtml 获取网页源代码

Delphi findwindow的一些用法

Delphi tlistview(tlistbox+图标显示)

Delphi图像二值化

Delphi2010中使用pchar时e2010 incompatible types: 'char' and 'ansichar' 错误的处理

Delphi idhttp http.get 获取json数据

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



打赏

取消

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

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

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

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

评论

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