如何获得当前系统正在运行的所有程序的名字和CLASS_Delphi
procedure TForm_main.Button1Click(Sender: TObject);
var
t:array [0..254] of char;
Name:PChar; // 名字
i,j,L,hnow:integer; //// 名字的长度
pos:tpoint;
begin
setlength(intlist,254);
i:=0;
j:=0;
http://www.gaodaima.com/65684.html如何获得当前系统正在运行的所有程序的名字和CLASS_Delphi
memo1.Lines.clear;
Memo1.Lines.Add('序号'+chr(9)+'句柄'+chr(9)+'程序');
while i<=65536 do
begin
//if i=3000 then abort ;
edit1.text:=inttostr(i);
self.Repaint;
L:=GetWindowTextLength(i)+1; // 得到名字长度,并将长度加1
GetMem(Name,L); //为将要得到的名字分配内存
GetWindowText(i,Name,L); //得到名字
FreeMem(Name,0); // 释放分配的内存
if GetWindowText(i, @name, 255)>0 then
begin
intlist[j]:=i;
inc(j);
Memo1.Lines.Add(inttostr(Memo1.Lines.Count)+chr(9)+inttostr(i)+chr(9)+trim(strpas(@name)));
end;
GetCursorPos(pos);
hNow:=WindowFromPoint(Pos);
GetClassName(hNow,@t,255);
if string(t)='Edit' then
Memo1.Lines.Add('Edit: '+inttostr(Memo1.Lines.Count)+chr(9)+inttostr(i)+chr(9)+trim(strpas(@name)));;
inc(i);
end;
end;
//以上控件名,都是标准命名的控件名,请自己定义一下即可。
欢迎大家阅读《如何获得当前系统正在运行的所有程序的名字和CLASS_Delphi》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码
原创文章,转载请注明: 转载自搞代码

微信 赏一包辣条吧~

支付宝 赏一听可乐吧~
发表评论