?
Solved

Execute program from visual c program

Posted on 2005-04-01
5
Medium Priority
?
197 Views
Last Modified: 2013-11-20
I have developed a visual c ++ program as a standard .exe and I need to have it execute/run another program that is a standard .exe.  I am having problems finding the correct code to accomplish this.
0
Comment
Question by:tpresenza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 8

Accepted Solution

by:
AaronReams earned 2000 total points
ID: 13683560
Hi tpresenza,

#include "shellapi.h"

ShellExecute(NULL, "open", "C:\\YouOtherApp.exe", NULL, NULL, SW_SHOWNORMAL);

Regards -A.R
0
 
LVL 8

Expert Comment

by:AaronReams
ID: 13683574
btw, you can also use _spawn
0
 
LVL 8

Expert Comment

by:AaronReams
ID: 13683609
Here's an example of using ShellExecute to call the external application "regsvr32.exe" and pass it a parameter of "tip.dll"...

 ::ShellExecute(NULL, NULL, _T("regsvr32.exe"), _T("tip.dll"), NULL, SW_SHOW);
0
 
LVL 8

Expert Comment

by:AaronReams
ID: 13683665
Here's how to use _spawnl....

spawnl(_P_NOWAIT,"C:\\Program Files\\Plus!\\Microsoft Internet\\IEXPLORE.EXE",NULL);

and the last method you can use is WinExec... but that has been deprecated.
0
 

Author Comment

by:tpresenza
ID: 13683680
Aaron,

Thanks.  I'll give it a try.

tpresenza
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 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