[comp.os.os2.programmer] Starting a

mabdoor@cs.vu.nl (Doorn van MAB) (05/23/91)

Problems...

I want to startup a (PM) application (e.g. SystemEditor, FileSystem, browser)
INSIDE my own program.
If my own program terminates, the started application should stay.
In fact, my program should execute the 'START' command.

I tried this sample program (originally from the online-ProgrammersReference):

----------------------------------
#define INCL_DOSPROCESS

#include <os2.h>

#define START_PROGRAM "c:\bin\pmview.exe"
 
CHAR        LoadError[100];
PSZ         Args;
PSZ         Envs;
RESULTCODES ReturnCodes;
USHORT      rc;
int i;
 
main()
{
    if(!DosExecPgm(LoadError,
                   sizeof(LoadError),
                   4, 
                   Args,
                   Envs,
                   &ReturnCodes,
                   START_PROGRAM))
       printf("Termination Code %d  Return Code %d \n",
              ReturnCodes.codeTerminate,
              ReturnCodes.codeResult);
}
------------------------------

It failed .... :-(

My question: HOW CAN I STARTUP AN PM-APPLICATION INSIDE MY OWN PROGRAM ??

Any suggestions are welcome, but please respond by e-mail.
Otherwise your answer might get expired, because I only read this group once
a week... :-)

You can contact me by e-mail:   mabdoor@cs.vu.nl

Thanks !

Matthijs van Doorn

________________________________________
"If debugging is the process of removing bugs, then programming must be
 the process of putting them in."

kenkahn@pksmrvm.vnet.ibm.com (Kenneth A. Kahn) (05/23/91)

For one thing the define for your file is incorrect.  It should be:

#define START_PROGRAM "c:\\bin\\pmview.exe"

Note the use of double slashes "\\" which are required by C.  Another thing
to consider is the type of the program making the DosExecPgm call.  This API
can be used only to start a program of the same type as yours; i.e. you can
only start a PM program from another PM program, a Full Screen program from a
Full Screen program, etc..  If you want to start a PM program from a
Full Screen or VIO Window program you need to use DosStartSession.