(Gast)
n/a Beiträge
|
Re: WoW - automatisch beenden - unsichtbar, im hintergrund
28. Okt 2009, 15:06
Du brauchst dazu GetTickCount und folgende Funktionen:
Delphi-Quellcode:
uses
Windows, TLHelp32, ShlObj;
...
...
function processExists(exeFileName: string): Boolean;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
Result := False;
while Integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
begin
Result := True;
end;
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
function KillProcess(const ExeName: String):Boolean;
var
Process: TProcessEntry32;
h: THandle;
begin
Result := False;
Process.dwSize := SizeOf(Process);
h := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
try
if Process32First(h, Process) then
repeat
if AnsiLowerCase(Process.szExeFile) = AnsiLowerCase(ExeName) then Result := TerminateProcess(OpenProcess(Process_Terminate, False, Process.th32ProcessID), 0);
until (not Process32Next(h, Process)) or Result;
finally
CloseHandle(h);
end;
end;
|
|
Zitat
|