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 .
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 .