Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I Launch Windows Aps from Other Windows Aps?

Posted on 1998-06-17
5
Medium Priority
?
148 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
[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
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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 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