本文整理自网络,侵删。
Delphi 取最前窗口标题(不重复)
memo1.Align:=alClient;
procedure TForm1.Timer1Timer(Sender: TObject);
var
p:pchar;
itemp:integer;
begin
p:=allocmem(255);
itemp:=GetForegroundWindow;
GetWindowText(itemp,p,255);
if (p<>'') then
begin
if Pos(p,Memo1.Text)=0 then //不重复,则添加,已有重复的不再添加到memo中
Memo1.Lines.Add(p) ;
end;
freemem(p,255);
end;
相关阅读 >>
Delphi twebbrowser get html source after ajax load
Delphi strtodatetime 这个函数在win7下出错
Delphi以鼠标为中心缩放图片以及拖动(采用区域抠图拉伸的方式)
更多相关阅读请进入《Delphi》频道 >>