本文整理自网络,侵删。
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 stringgrid 实例4 本例功能: 1、给每个单元格赋值 2、调整当前单元格位置:上下左右;
Delphi embeddedwb 遍历frames并执行子frame的js脚本
更多相关阅读请进入《Delphi》频道 >>