现在的位置: 首页 > 综合 > 正文

判断程序是否正在运行

2011年08月26日 ⁄ 综合 ⁄ 共 471字 ⁄ 字号 评论关闭
function IsRuning(const AObjectName: string): Boolean;{AObjectName='aaa.exe'}
var
  lppe : TProcessEntry32;
  sshandle: Thandle;
  found: boolean;
begin
  Result :
= False;
  sshandle :
= CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
  found :
= Process32First(sshandle,lppe);
  
while found do   
  
begin 
    
if LowerCase(lppe.szExeFile) = LowerCase(AObjectName) then
    
begin
      Result :
= True;
      Exit;
    
end;
    found :
= Process32Next(sshandle, lppe);
  
end
end;

别忘了,Use TlHelp32

抱歉!评论已关闭.