Kullanımı:
if not ( (UygulamaCalisiyorMu('PROGRAM.exe')) ) then begin
//Çalışmıyor ise yapıalcaklar.
end;
FONKSİYON Aşağıda
uses TlHelp32; // eklenmeli.
function UygulamaCalisiyorMu(PROGRAM_NAME :string): Boolean;
var
devam: BOOL;
fyakhandle: THandle;
islem32 : TProcessEntry32;
snc:boolean;
begin
snc:=False;
fyakhandle :=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
islem32.dwSize:=Sizeof(islem32);
devam :=Process32First(fyakhandle,islem32);
while integer(devam)<>0 do begin
if (islem32.szExeFile=PROGRAM_NAME) then
snc:=True ;
devam:=Process32Next(fyakhandle,islem32);
end;
CloseHandle(fyakhandle);
result:=snc;
end;
function UygulamaCalisiyorMu(PROGRAM_NAME :string): Boolean;
var
devam: BOOL;
fyakhandle: THandle;
islem32 : TProcessEntry32;
snc:boolean;
begin
snc:=False;
fyakhandle :=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
islem32.dwSize:=Sizeof(islem32);
devam :=Process32First(fyakhandle,islem32);
while integer(devam)<>0 do begin
if (islem32.szExeFile=PROGRAM_NAME) then
snc:=True ;
devam:=Process32Next(fyakhandle,islem32);
end;
CloseHandle(fyakhandle);
result:=snc;
end;
Hiç yorum yok:
Yorum Gönder