var lppe: TProcessEntry32;
Found : boolean;
Hand,hProcess:THandle;
begin
Hand:=CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
lppe.dwSize:=SizeOf(TProcessEntry32);
found:=Process32First(Hand,lppe);
while Found do
begin
hProcess:=OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,False,lppe.th32ProcessID);
if hProcess>0 then
if lppe.szExeFile='QQ.exe' then
begin
ShowMessage('QQ.exe已经运行');
exit;
end;
Found := Process32Next(Hand,lppe);
end;
ShowMessage('QQ.exe没有运行');
end;