1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
program Project2; uses windows,TLHelp32; function FindProcess(AFileName:string):boolean; var hSnapshot:THandle; lppe:TProcessEntry32; Found:Boolean; begin Result:=False; hSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); lppe.dwSize:=SizeOf(TProcessEntry32); Found:=Process32First(hSnapshot,lppe); while Found do begin if(lppe.szExeFile = AFileName) then Result:=True; Found:=Process32Next(hSnapshot,lppe); end; end; begin if FindProcess('QQ.exe') then MessageBox(0, PChar('QQ存在'), PChar('提示'), MB_OK); end. |
转载请注明:exchen's blog » Delphi 进程判断