|
Borland C ++ Builder FAQ
|
||
| The content | The last update: 12/12/2008 | |
|
How to "kill" process, knowing it pid? The author: OlegGG bool KillProcByPid (DWORD pid)
{
DWORD ExitCode;
HANDLE hp;
bool ret = true;
if (pid)
{
hp = OpenProcess (PROCESS_ALL_ACCESS, true, pid);
if (hp)
{
GetExitCodeProcess (hp, &ExitCode);
ret = TerminateProcess (hp, ExitCode);
}
else
{
return false;
}
}
else
{
return false;
}
CloseHandle (hp);
return ret;
}
|