[comp.os.os2.programmer] Help using DosStartSession and error status

gould@pilot.njin.net (Brian Jay Gould) (01/29/91)

In the past I've use DosExecPgm to start another program, but now
I need to keep it as a child process.  DosStartSession is very 
poorly documented.  Any ideas on what to put in Environment and
TermQ?

I'm getting a status return of 4367 and can't find any information
on it in any documentation.  Any help?

Do you put the .exe extension on the program name?  Will the path
environment variable be used, or must the file be explicitly used?

Any help. (or a program-segment as an example) would be greatly
appreciated.

Thanks.
-- 
--
Any disclaimers made for me, by me, or about me - may or may not accurately
reflect my failure to be reflecting the opinions of myself or anyone else.
*************************************************
*  Brian Jay Gould - Professional Brain-stormer *
*************************************************

ballard@cheddar.ucs.ubc.ca (Alan Ballard) (01/30/91)

In article <Jan.28.21.54.02.1991.6554@pilot.njin.net> gould@pilot.njin.net (Brian Jay Gould) writes:
>In the past I've use DosExecPgm to start another program, but now
>I need to keep it as a child process.  
>I'm getting a status return of 4367 and can't find any information
>on it in any documentation.  Any help?

This doesn't seem to be a valid error code according to the header files. 
Are you sure you're displaying it correctly?

The following is a fragment of code that provides a simple 
example of the use of DosStartSession.
 
/*
 * Start the specified program as a separate, unrelated, background
 * session. 
 *
 * Parameters are name of program, which must include extension and must
 * either be in the search path or include fully specified path, and
 * argument string to pass to it.  Argument string may be specified as 
 * NULL, otherwise it a single 0-terminated string constituting the 
 * "tail" of a command line for the program.
 */
void FAR
StartSession(NPSZ npszName, PSZ pszArgs)
   STARTDATA       stdata;
   USHORT          idSession;
   int             rc;

   WtiLFillStruct(&stdata, sizeof(stdata), 0);  /* zero-fill the struct */
   stdata.Related = FALSE;
   stdata.Length = sizeof(stdata);
   stdata.FgBg = TRUE;
   stdata.PgmName = npszName;
   stdata.PgmInputs = pszArgs;

   if (rc = DosStartSession(&stdata, &idSession, &pid)) 
      fprintf(stderr, "rc=%d from DosStartSession\n", rc);
}
Alan Ballard                   | Internet: ballard@ucs.ubc.ca
University Computing Services  |   Bitnet: USERAB1@UBCMTSG
University of British Columbia |    Phone: 604-228-3074
Vancouver B.C. Canada V6R 1W5  |      Fax: 604-228-5116