WinExedc or Create Process

I am trying to spawn another application from within my program.  I am currently using MFC framework to program.  I know that I should use Create Process or WinExec, but I am unsure of the syntax.  I have tried several times, but am unsuccessful.  Does anyone know the proper syntax...
suppose the program is anything.exe

Who is Participating?
galkinConnect With a Mentor Commented:
you can use either CreateProcess or WinExec. CreateProcess is recommended. Before calling this function you must fill STARTUPINFO structure, cb member must be set to seziof(STARTUPINFO) and other structure members must be set to 0(NULL).
Valid address to PROCESS_INFORMATION structure must also be specified.
In WinExec you can provide full path to executable or if only file name if EXE in the same directory or in current directory.
I guess Excel is OLE server so it should be launched using OLE CocreateInstance function rather then WinExec
mikeljjAuthor Commented:
Edited text of question
I was doing something similar. I wanted to open an Excel spreadsheep from with-in my app, by using the associations within Win95. See if:


is what you want. For me, what works is: (actual line from code)

ShellExecute(NULL, NULL, m_spreadsheet_display_name, NULL, NULL, SW_MAXIMIZE);

-Dex Man

mikeljjAuthor Commented:
Does the application have to include a direct path??
Or does the file or application have to be in the Windows directory--- since this is the only way I can get it to work
mikeljjAuthor Commented:
thanks, I figured it out
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.