打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
WinAPI: WindowFromPoint- 获取指定点所在窗口的句柄 - 万一的 Delphi 博客 - 博客园
//声明:WindowFromPoint(Point: TPoint): HWND;
//举例:unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, ExtCtrls;typeTForm1 = class(TForm)Button1: TButton;Timer1: TTimer;procedure Timer1Timer(Sender: TObject);end;varForm1: TForm1;implementation{$R *.dfm}varh: HWND;procedure TForm1.Timer1Timer(Sender: TObject);varpt: TPoint;arr: array[0..254] of Char;beginif GetCursorPos(pt) then {如果能获取点}beginh := WindowFromPoint(pt); {返回句柄}GetClassName(h, arr, Length(arr)); {获取该句柄窗口的类名}Text := arr; {显示在标题}end;end;end.
//效果图:


0
0
(请您对文章做出评价)
« 上一篇:说到"计算器", 建议大家用它
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
详解 EnumWindows 与 EnumWindowsProc
delphi获取360窗口句柄
用Delphi做一个组件探测器:WidgetSpy
C#实现屏幕取词 | 学步园
常用作帖、发帖代码集萃
SDL 资料收集站 - C BUILDER让你的任务栏图标动起来
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服