Previously we used shellexecute () for calling a windows .exe file (e.g cmd.exe with some parameters) from VC++. But next step after calling shellexecute() started to begin its execution before the shell execution completes. It created some mess-ups.
We came to know that WaitForSingleObject can be used for synchronizing the execution.
But we have to use shellexecuteex () instead of shellexecute ().
And, syntax of shellexecuteex () will be different from shellexecute ().
You can refer the below sample code refered from codeguru.com
You can bookmark this blog for further reading, or you can subscribe to our blog feed.