• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 748
  • Last Modified:

Call exe from C++ and wait for finish

Hi,

I need to call EXE from MV C++ for example, Notepad.exe. C++ Program will be waiting for Notepad.exe finished (close) then continue. I am using:

ShellExecute(0,"OPEN","Notepad.exe",sTXTFile,NULL,SW_HIDE);

It seems is not waiting. Do you know which function can do this?

Thanks.
0
Jing272
Asked:
Jing272
1 Solution
 
jjardineCommented:
Have a look at the ShellExecuteEx   function which will support the ShellExecuteInfoStructure.   You can get a handle to the application process  'hprocess'  from ShellExecuteInfoStructure  and then use that in the waitforsingleobject function.    This is taken from http://www.webxpertz.net/forums/showthread.php?t=21020 
0
 
Jing272Author Commented:
Could you give me a example code in C++?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now