怎么查看exe程序是否运行(200)

  • 主题发起人 yanjian99
  • 开始时间
Y

yanjian99

Unregistered / Unconfirmed
GUEST, unregistred user!
各位高手请问怎么根据文件名去判断此文件已经在进程中运行?如果没有运行我想用windows的喇叭不断的叫提醒.急,谢谢
 
遍历进程+Beep
 
查找进程的代码function FindProcessId(ExeFileName: string):boolean;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(FProcessEntry32.szExeFile)=UpperCase(ExeFileName) then begin result:=true; break; end; ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32); end; CloseHandle (FSnapshotHandle);end;
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部 底部