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 释放资源文件中的exe文件并运行

Delphi unigui 调用js

Delphi 7 + gdiplus 简单实现双缓冲绘制移动图形

Delphi xe firemonkey的stylebook皮肤控件的使用

Delphi 调用api.ocr.space的ocr接口

Delphi 获取打开文件的pid

Delphi urlencode

Delphi 10.2 ide界面

Delphi mscomm简单的中间pc串口数据中转

Delphi中json回车换行符转义

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



打赏

取消

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

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

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

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

评论

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