|
-
March 31st, 1999, 03:52 AM
#1
How to terminate a process?
How do I terminate a process which was created by CreateProcess function?
Here is what I got so far:
void CMFPView::OnFaxEditor()
{
STARTUPINFO sinfo = {sizeof(sinfo), NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, STARTF_USESHOWWINDOW, SW_SHOW, 0, NULL,
NULL, NULL, NULL};
PROCESS_INFORMATION pinfo;
CreateProcess(NULL, "d:\\mfp\\faxNumStg-VB\\faxNumStg.exe",
NULL,NULL,FALSE,CREATE_DEFAULT_ERROR_MODE,NULL,NULL,
&sinfo,&pinfo);
}
The faxNumStg AP doesn't terminate unless user choose to close the AP. If user did not close faxNumStg AP, how do I
terminate faxNumStg AP automatically when the calling AP was terminated. Any suggestion would be greatly appreciated.
Thanks in advance.
Best Regards,
Tiffany Chen
-
March 31st, 1999, 04:45 AM
#2
Re: How to terminate a process?
You could use
TerminateProcess(pinfo.hProcess,nExitCode);
(and remember to close the handles pinfo.hProcess and pinfo.hThread).
This may be a bit abrupt though! Another alternative is to use FindWindow to get the main window to the FaxEditor and try sending a WM_CLOSE or WM_QUIT message to it. If this works, it will give the program a chance to shutdown a bit more gracefully.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|