Kill Child Process
I need kill all child process when i kill the parent process.
In this example i run "notepad.exe".
But if i close my program "ALT + CRTL + DEL Terminate process". Notepad.exe is still runnig.
My english sux i known
I need kill all child process when i kill the parent process.
Code:
#include <windows.h>
#include <stdio.h>
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory ( &si, sizeof( si ) );
si.cb=sizeof ( si );
CreateProcess( "notepad.exe", 0, 0, 0, 0, BELOW_NORMAL_PRIORITY_CLASS, 0, 0, &si, &pi );
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return 0;
}
In this example i run "notepad.exe".
But if i close my program "ALT + CRTL + DEL Terminate process". Notepad.exe is still runnig.
My english sux i known