?
Solved

Execute program from visual c program

Posted on 2005-04-01
5
Medium Priority
?
200 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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…

621 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