Solved

How do I Launch Windows Aps from Other Windows Aps?

Posted on 1998-06-17
5
141 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

708 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

17 Experts available now in Live!

Get 1:1 Help Now