TerminateProcess(), Task Manager...
Posted on 2002-06-14
I wrote a client/server software. I login client from server and logged pc runs Counter Strike game. When i logout i am terminating all running visible windows. It works fine but if i try to run Counter Strike again it generates error so it doesn't run. It also happens with Fifa sometimes. But this problem started after the new version of CS game. If i terminate Counter Strike using Ctrl + Alt + Del so it works fine again. This is happening in win98 i didn't try other os. I also tried to kill DDhelp (DirectX) as written MSDN but no chance. I like to know what does ctrl + alt + del uses and how does it force terminate applications?
Termination code i wrote is:
function TEasyUtils.KillTask(pid: Int64): boolean;
Result := False;
if (pid > 0) and (pid <> GetCurrentProcessId) then
hw := OpenProcess(PROCESS_ALL_ACCESS, False, pid);
if hw > 0 then
Result := TerminateProcess(hw, 0);
I call this like: