delphi 取得当前运行窗口的标题


本文整理自网络,侵删。

 procedure tform1.timer1timer(sender:object);
var
whandle,wparenthandle:hwnd;
wcaptionlen:integer;
wtext:pchar;
ctime:tdatetime;
window,number_window:longint;
begin
//取得时间
ctime:=now();
//取得窗口名
whandle:=getforegroundwindow();
//取得当前活动的应用程序的窗口句柄
wparenthandle:=getparent(whandle);
if wparenthandle<>0 then
whandle:=wparenthandle;
wcaptionlen:=getwindowtextlength(whandle);
getmem(wtext,wcaptionlen+1);
getwindowtext(whandle,wtext,wcaptionlen+1);
memo1.text:=datetostr(ctime)+'-'+timetostr(ctime)+'所属程序:'+wtext;
end;

相关阅读 >>

Delphi 判断安卓app第一次启动

Delphi tfdquery提交tfdmemtable修改的数据

Delphi word转pdf两种方法

Delphi 屏蔽汉字,年月日,时间,银行卡正则表达式

Delphi idhttp.post超时导致整个线程停止问题解决

Delphi 验证guid的函数

Delphi 实现如何枚举所有打开的ie选项卡

Delphi 搜索内存偏移函数

python4Delphi 示例应用程序在 Delphi 应用程序中运行简单的 python 脚本

Delphi结合winrar生成自解压文件

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



打赏

取消

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

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

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

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

评论

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