1. program Project2;
  2. uses
  3. windows,TLHelp32;
  4. function FindProcess(AFileName:string):boolean;
  5. var
  6. hSnapshot:THandle;
  7. lppe:TProcessEntry32;
  8. Found:Boolean;
  9. begin
  10. Result:=False;
  11. hSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
  12. lppe.dwSize:=SizeOf(TProcessEntry32);
  13. Found:=Process32First(hSnapshot,lppe);
  14. while Found do
  15. begin
  16. if(lppe.szExeFile = AFileName) then Result:=True;
  17. Found:=Process32Next(hSnapshot,lppe);
  18. end;
  19. end;
  20. begin
  21. if FindProcess('QQ.exe') then
  22. MessageBox(0, PChar('QQ存在'), PChar('提示'), MB_OK);
  23. end.
 
http://blog.csdn.net/cmdasm/article/details/9961575
04-28 01:44