How do I Launch Windows Aps from Other Windows Aps?

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?
bfrenchAsked:
Who is Participating?
 
karauConnect With a Mentor Commented:
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
 
t004024Commented:
To launch another application from one Windows application U can use ShellExecute or WinExec functions.
0
 
galkinCommented:
CreateProcess is preffered.
0
 
karauCommented:
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
 
YKuniskyCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.