delphi 检测进程是否存在函数


本文整理自网络,侵删。

 uses
TlHelp32;


function CheckTask(ExeFileName: string): Boolean; //检测XX进程是否存在函数
const
PROCESS_TERMINATE = $0001;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
result := False;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while integer(ContinueLoop) <> 0 do begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName))
or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
result := True;
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
end;

相关阅读 >>

Delphi操作多显示器

Delphi的控制台程式添加公司信息、版权信息

Delphi 异或加解密

Delphi实现解析百度搜索结果link?url=

Delphi 查询某个字符在字符串出现的位置,支持查找次数

Delphi 用cxgrid显示联合查询数据和更改数据

Delphi 解析json生成json

Delphi 过滤开头 结尾 全部 空格的函数

Delphi中使用android振动

Delphi文件管理类函数

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



打赏

取消

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

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

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

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

评论

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