Click to See Complete Forum and Search --> : ExitProcess


SSP
May 18th, 1999, 11:06 AM
Hi,
From my NT Service(non MFC), I call ExitProcess() to kill a MFC app. But ExitProcess doesn't work. It doesn't exit the process.
Does anyone have any clue ? Any other ways to kill MFC app ?
I used TerminateProcess(), but by calling it, the MFC app is getting killed but, the destructor code is not getting executed.

You input will be appreciated.


Here is the code -

//Open the process to get the handle for get
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE, m_dwProcessID);
if(hProcess)
{
GetExitCodeProcess(hProcess, lpExitCode);
CloseHandle(hProcess);
}

if(lpExitCode)
{
ExitProcess((UINT)lpExitCode);
}