Registriert seit: 30. Okt 2007
40 Beiträge
Delphi 2007 Professional
|
Re: Could Not Bind Socket
19. Aug 2009, 14:55
Danke wicht,
Es funktioniert !!
Hab den Code hier übernommen:
Delphi-Quellcode:
function TMainForm.GetProcess(Process: String; KillProcess: Boolean): Boolean;
var
hProcSnap : THandle;
pe32 : TProcessEntry32;
begin
Result := False;
hProcSnap := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
If hProcSnap <> INVALID_HANDLE_VALUE then
begin
pe32.dwSize := SizeOf(ProcessEntry32);
If Process32First(hProcSnap, pe32) then
While Process32Next(hProcSnap, pe32) do
begin
If Pos(Process, LowerCase(pe32.szExeFile)) <> 0 then
begin
If KillProcess then
begin
Result := TerminateProcess(OpenProcess(Process_Terminate, False, pe32.th32ProcessID), 0)
end
//If KillProcess then Result := TerminateProcess(OpenProcess(Process_Terminate, False, pe32.th32ProcessID), 0)
Else Result := True;
Break;
end;
end;
CloseHandle(hProcSnap);
end;
end;
|
|
Zitat
|