TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: David Sparrman
from: Greg Varga
date: 1997-03-08 10:00:10
subject: Re: Starting a child session in Pascal

> Function SynchExecSess(pgmTitle, pgmName :CString) :ApiRet;

 > Var psd      :StartData;
 >     sessID   :ULong;
 >     apid     :PID;
 >     objBuf   :CString;
 >     rc       :ApiRet;

 > Begin
 >   psd.aLength := SizeOf(StartData);
 >   psd.Related := SSF_RELATED_CHILD;
 >   psd.FgBg := SSF_FGBG_BACK;
 >   psd.TraceOpt := SSF_TRACEOPT_NONE;
 >   psd.pgmTitle := {at}pgmTitle;
 >   psd.pgmName := {at}pgmName;
 >   psd.pgmInputs := NIL;
 >   psd.TermQ := NIL;
 >   psd.Environment := NIL;
 >   psd.InheritOpt := SSF_INHERTOPT_PARENT;
 >   psd.SessionType := SSF_TYPE_DEFAULT;
 >   psd.IconFile := NIL;
 >   psd.pgmHandle := 0;
 >   psd.pgmControl := SSF_CONTROL_VISIBLE | SSF_CONTROL_MAXIMIZE;
 >   psd.InitXPos := 30;
 >   psd.InitYPos := 40;
 >   psd.InitXSize := 200;
 >   psd.InitYSize := 140;
 >   psd.Reserved := 0;
 >   psd.ObjectBuffer := {at}objBuf;
 >   psd.ObjectBuffLen := 100;
 >   rc := DosStartSession(psd, sessID, apid);
 >   If rc  0 Then ;
 >   { Implement proper error handling here }
 >   SynchExecSess := rc;
 > End;

Are you aware that objbuf, (Being on the stack local to this procedure), gets 
disposed after the procedure ends. IF CString is a ^CHAR, (which it seems that 
it is), then you have to use a GETMEM(objbuf,  to allocate memory 
for it. (Otherwise it just points to nothing'ness) :)

Greg Varga
Co-Owner: B.V. Compuworks Group
xomorph{at}skybus.com


--- AdeptXBBS v1.08.01 (Registered)
* Origin: Conceptual Realities - 1:153/9118 (604-576-1971) (1:153/9118)
SEEN-BY: 50/99 54/99 270/101 620/243 625/160 711/401 413 430 934 712/311 407
SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1
@PATH: 153/970 716 920 270/101 712/624 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.