Suspend Program Execution
-
I have an SDI app that uses an ini file to store settings. The user has the option to manually edit the ini file from my program, which is done through notepad. What I want to do is suspend execution of my program until notepad exits. I read up on createprocess() and shellexecute() along with waitforsingleobject()but couldnt figure out how to do it. Any help would be great! Thanks, Daniel
-
I have an SDI app that uses an ini file to store settings. The user has the option to manually edit the ini file from my program, which is done through notepad. What I want to do is suspend execution of my program until notepad exits. I read up on createprocess() and shellexecute() along with waitforsingleobject()but couldnt figure out how to do it. Any help would be great! Thanks, Daniel
here is some code I use to open an UDL file and wait for the UDL Editor to exit. BUT! Your main thread is blocked and so the repaint is blocked!!!
SHELLEXECUTEINFO inf; memset(&inf,0,sizeof(SHELLEXECUTEINFO)); inf.cbSize = sizeof(SHELLEXECUTEINFO); inf.fMask=SEE_MASK_NOCLOSEPROCESS; inf.lpVerb=_T("open"); inf.lpFile=sUdlFile; if(ShellExecuteEx(&inf)) { WaitForSingleObject(inf.hProcess,-1); CloseHandle(inf.hProcess); }
-
here is some code I use to open an UDL file and wait for the UDL Editor to exit. BUT! Your main thread is blocked and so the repaint is blocked!!!
SHELLEXECUTEINFO inf; memset(&inf,0,sizeof(SHELLEXECUTEINFO)); inf.cbSize = sizeof(SHELLEXECUTEINFO); inf.fMask=SEE_MASK_NOCLOSEPROCESS; inf.lpVerb=_T("open"); inf.lpFile=sUdlFile; if(ShellExecuteEx(&inf)) { WaitForSingleObject(inf.hProcess,-1); CloseHandle(inf.hProcess); }
Thanks! Works great!