Click here to Skip to main content
15,902,874 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:


i have a console application from which i have created two cmd.exe process's.  i want to capture the SIGINT signal in the console app and in the callback fuction of SIGINT i want to close the two processes created.  but the processes are not terminated.

 

the call back of the SIGINT looks like this:

void cleanup(int data)
{

DWORD lpExitCode;
        GetExitCodeProcess(processInfoMain.hProcess,&lpExitCode);
        if(!TerminateProcess(processInfoMain.hProcess,lpExitCode))
        {
            printf("\n unable to terminateprocess");
        }
    GetExitCodeProcess(processInfoRil.hProcess,&lpExitCode);
    if(!TerminateProcess(processInfoRil.hProcess,lpExitCode))
    {
        printf("\n unable to terminateprocess");
    }

 } 

 

could any one please help me how to terminate the two processes created.

Posted

Do NOT use T<code>erminateProcess

See the 'Remarks' section here [^] 

.
 
Share this answer
 
are you sure from the ProcessID which are you passing are correct?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900