Solved

How do I Launch Windows Aps from Other Windows Aps?

Posted on 1998-06-17
5
144 Views
Last Modified: 2013-11-20
How do I launch Windows applications from other Windows applications or does anyone know a book that might have this information.  Also can there is exist some "simple" communication?
0
Comment
Question by:bfrench
5 Comments
 

Expert Comment

by:t004024
ID: 1318117
To launch another application from one Windows application U can use ShellExecute or WinExec functions.
0
 
LVL 7

Expert Comment

by:galkin
ID: 1318118
CreateProcess is preffered.
0
 

Accepted Solution

by:
karau earned 50 total points
ID: 1318119
galkin is correct, use CreateProcess.  Here is a copy of the code
that I used in my app to do this:


 int len = MyPopClass.PFile.GetLength()+1;
 char* str = new char[len];
 lstrcpy(str, m_PFile);
 if(!CreateProcess(NULL,str,NULL,NULL,FALSE,0,NULL,NULL,&start,&proc))
   AfxMessageBox("Unable to Launch Program",MB_OK|MB_ICONSTOP);

in this example MyPopClass.PFile is a CString and the code between that and the CreateProcess is used to convert it to a char that CreateProcess needs.  As I recall the first parameter set to NULL is the pointer to the parent (CWnd *), but the other ones you would have to look up under Help.

j. karau
0
 

Expert Comment

by:karau
ID: 1318120
I also forgot to include the fact that start and proc are global variables that are declared as follows:

STARTUPINFO      start;
PROCESS_INFORMATION proc;
0
 

Expert Comment

by:YKunisky
ID: 1318121
I agree that Galkin gave correct answer to use  function
"CreateProcess"
I  wish to advice a book "Advanced Visual C++ 5"
Steven Holzner ISBN 1-55851-565-8 which
has an examples of codes in chapter 7.
For example,how to call MS calculator from your application
using Windows hooks.
I think there is a good decision  to exchange data between
to applications using pipes.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 188
Folder Comparison 12 54
sumDigits challenge 9 170
Sed question 2 100
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…
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…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

790 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