Call exe from C++ and wait for finish

Posted on 2008-11-19
Last Modified: 2013-12-14

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:


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

Question by:Jing272
    LVL 14

    Expert Comment

    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

    Author Comment

    Could you give me a example code in C++?
    LVL 3

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now