Article View: comp.os.os2.programmer
Article #40Re: Execute a non PM program from a PM program
From: Peter Forsberg
Date: Thu, 29 Oct 1992 08:06
Date: Thu, 29 Oct 1992 08:06
47 lines
2346 bytes
2346 bytes
In <1992Oct29.024549.28633@ucsu.Colorado.EDU> GAMAGE NIMAL K K writes:
> I am trying to execute a non PM program from a PM program.
> Can somebody send me a simple code showing how to do it.
> I did not have any problem executing a PM program from
> a PM program.
>
> Gamage
>
> gamage@spot.colorado.edu
>
You have to use DosStartSession, not DosExecPgm when the types of
the programs are different (this really should go into some FAQ).
Here is a sample that starts CMD.EXE:
// Set up the STARTDATA struct...
// ------------------------------
sd.Length = sizeof (STARTDATA);
sd.Related = 1; // Related
sd.FgBg = 1; // Background
sd.TraceOpt = 0; // Trace
sd.PgmTitle = "My CMD.EXE"; // PgmTitle
sd.PgmName = NULL; // NULL => CMD.EXE
sd.PgmInputs = "";
sd.TermQ = NULL; // No TermQ
sd.Environment = NULL; // Inherit env...
sd.InheritOpt = 1; // ...from us
sd.SessionType = 2; // Windowed session
sd.IconFile = NULL; // Use system provided icon
sd.PgmHandle = 0L; // No pgmhandle
sd.PgmControl = 0x0004; // Minimize
sd.InitXPos = 0;
sd.InitYPos = 0;
sd.InitXSize = 0;
sd.InitYSize = 0;
rc = DosStartSession(&sd, &usSessId, &pidCmd);
Please see the CP reference for details about the STARTDATA struct
and how to set its fields. This is only a sample.
/Peter
--
Peter Forsberg E-mail: peterf@vnet.ibm.com (primary)
d88-pfo@nada.kth.se (alternate)
Disclaimer: This posting represents the poster's views, not those of IBM
Technical Details
Message-ID:
<19921028.231219.244@almaden.ibm.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!vnet.ibm.comReferences:
<1992Oct29.024549.28633@ucsu.Colorado.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!vnet.ibm.com From: peterf@vnet.ibm.com (Peter Forsberg) Message-ID: <19921028.231219.244@almaden.ibm.com> Date: Thu, 29 Oct 92 08:06:07 SWE Newsgroups: comp.os.os2.programmer Subject: Re: Execute a non PM program from a PM program Reply-To: peterf@vnet.ibm.com Organization: IBM Corporation Disclaimer: This posting represents the poster's views, not those of IBM News-Software: UReply 3.0 References: <1992Oct29.024549.28633@ucsu.Colorado.EDU> Lines: 47