delphi 通过进程ID获取进程名


本文整理自网络,侵删。

 
uses TLhelp32
function GetProcessNameById(const AID: Integer): String;
var    
h:thandle;     
f:boolean;     
lppe:tprocessentry32;
begin    
Result := '';     
h := CreateToolhelp32Snapshot(TH32cs_SnapProcess, 0);     
lppe.dwSize := sizeof(lppe);     
f := Process32First(h, lppe);     
while integer(f) <> 0 do    
begin      
if Integer(lppe.th32ProcessID) = AID then      
begin        
Result:= StrPas(lppe.szExeFile);         
break;       
end;       
f := Process32Next(h, lppe);     
end;
end;

相关阅读 >>

Delphi 一行关键代码阻止360云查杀

Delphi 用dde控制word

Delphi 如何将字符串中的半角字符转换为全角字符

Delphi wininet带进度下载http文件

Delphi 自动升级组件autoupgrader简单教程

Delphi 判断端口是否被使用

Delphi 动态调用chm文件

Delphi 中 16 进制转换为 10 进制

Delphi下载网站文件(支持https协议)

Delphi tnethttpcleint提交json串

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



打赏

取消

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

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

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

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

评论

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