TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Brandt Everett
from: Phil Crown
date: 1995-11-09 18:38:32
subject: Watcom DosStartSession

-=> Quoting Brandt Everett to Johan Siegers <=-

 BE> RE: Watcom DosStartSession He
 BE> BY: Johan Siegers to Brandt Everett on Tue Oct 17 1995 08:01:18

 BE> For example:
 BE> I want to start the program SCFG.EXE with d:\sbbs\ctrl as a
 BE> command line parameter.  It is a OS/2 program, but not PM.

 BE> In the StartData.PgmInputs I would have "d:\sbbs\exec\scfg.exe
 BE> d:\sbbs\ctrl" and notheing in the PgmName?  Or do I just have
 BE> "d:\sbbs\ctrl" in PgmInputs and
"d:\sbbs\exec\scfg.exe" in the PgmName?

I'm using BCOS2 C++ v2.0, and use the following to run my editor (QEdit
which is a text mode program) but it works for E.EXE (PM) too.  Just make
sure the executable has an .EXE extension and you pass it to the function.
If you want it to be a full-screen session, change the SSF_TYPE_* below.

I call this with something like,

  PCHAR   editor  =   "E:\\Ut\\Q.exe";
  PCHAR   fname   =   "some.txt";

  RunEditor(editor, fname);

// --------------------------------------------------------------------

MRESULT EXPENTRY  RunEditor(PCHAR pEditor, PCHAR pfname)
{
  STARTDATA   StartData;
  CHAR        ObjBuf[100];
  CHAR        Args[CCHMAXPATH];
  PCHAR       Title, fname, ext;
  PID         pid;
  ULONG       SessID;

  Title = (PCHAR) malloc(CCHMAXPATH);
  fname = (PCHAR) malloc(CCHMAXPATH);
  ext   = (PCHAR) malloc(CCHMAXPATH);

  _splitpath(pfname, NULL, NULL, fname, ext);
  sprintf(Title, "%s - %s%s", pEditor, fname, ext);

  sprintf(Args, "%s", pfname);
  StartData.Length      = sizeof(STARTDATA);
  StartData.Related     = SSF_RELATED_CHILD;
  StartData.FgBg        = SSF_FGBG_FORE;//BACK;
  StartData.TraceOpt    = SSF_TRACEOPT_NONE;
  StartData.PgmTitle    = Title;
  StartData.PgmName     = pEditor;
  StartData.PgmInputs   = (PBYTE) Args;
  StartData.TermQ       = 0;
  StartData.Environment = 0;
  StartData.InheritOpt  = SSF_INHERTOPT_PARENT;
  StartData.SessionType = SSF_TYPE_DEFAULT;//SSF_TYPE_FULLSCREEN;
  StartData.IconFile    = 0;
  StartData.PgmHandle   = 0;
  StartData.PgmControl  = SSF_CONTROL_VISIBLE | SSF_CONTROL_SETPOS;//MAXIMIZE;
  StartData.InitXPos    = 30;
  StartData.InitYPos    = 40;
  StartData.InitXSize   = 200;
  StartData.InitYSize   = 140;
  StartData.Reserved    = 0;
  StartData.ObjectBuffer= ObjBuf;
  StartData.ObjectBuffLen = 100;
  DosStartSession(&StartData, &SessID, &pid);
  free(Title);
  free(fname);
  free(ext);
  return (MRESULT) 0;
}

phil.crown{at}bluecafe.com


--- Blue Wave/Max v2.22a
* Origin: * MacSavvy * Dallas * Mac * OS/2 * (214)250-4479 * (1:124/1208)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 124/1208 1 396/1 270/101 712/515 711/808 809 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™.