Main question : how to kill a process (Delphi 5 or 7(as U want) , XP )
Origin :
I use Firebird Classic as DB. For each connection, a new firebird process is created on the server. this would not be a problem, except when the Client lose the connection for any resaon (hard reboot, network problem...) : In such case, the process stay launched on the server, and its attached ressources stay reserved (ie Memory).
I am abble to retreive with instance is no more connected with a client, and get this PID.
I tried this, but it does not works:
procedure TForm1.KillProcess(PID: Cardinal);
var
exitcode:UINT;
x:THandle;
begin
x:=Openprocess(PROCESS_ALL
_ACCESS,fa
lse,PID);
GetExitCodeProcess(x,ExitC
ode);
TerminateProcess(x,Exitcod
e);
end;
--> X always receive 0 from OpenProcess (why?)
I also tried this :
procedure TForm1.KillProcess(PID: Cardinal);
begin
SendMessage(PID,wm_close,0
,0);
end;
but it also does not seems to works...
Thanks for any help.
Ekim
Start Free Trial