TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: jari laaksonen
date: 1995-12-21 16:53:02
subject: idea for program

PF> I had envisioned overriding the launch method (and calling
PF> DosStartSession myself).  Would this solve the problem?

As far as I know the launch method is wpOpen which is called when the
program object is double clicked _and_ when Settings is opened. There is a
parameter ulView which is supposed to be OPEN_RUNNING when launching and
OPEN_SETTINGS when opening Settings, but for example when creating the
program object from Template, wpOpen is called twice: first with
OPEN_RUNNING and then with OPEN_SETTINGS. The other parameter of wpOpen is
hwndCnr which _seems_ to be 0 when creating the object, but the
documentation says only that "it _may_ be set to NULLHANDLE", not
that in what situation it _is_ 0.

So, it might be possible to override the launching using code like this (pseudocode):

HWND wpOpen (..., HWND hwndCnr, ULONG ulView, ...)
{
  if (ulView == OPEN_RUNNING && hwndCnr != 0)
  {
    wpQueryProgDetails() // for the executable name
    read user defined environment settings
    if LIBPATH is defined
      DosSetExtLIBPATH (...)
    fill in the start-data
    DosStartSession (start-data, ...)
    DosSetExtLIBPATH (NULL, ...) // remove the ext libpath from THIS process!
    // don't call parent_wpOpen!
    return (something) // note: the return value is HWND
  }
  else return parent_wpOpen (...)
}

jl>> - using wpSetProgDetails seems to have no effect when
jl>> a DOS session object is launched.

PF> My reason for coming up with this idea was the insane length of my
PF> config.sys LIBPATH -- something that does not affect DOS programs.
PF> IOW,I don't think supporting dos pgms is a priority.

If you can set PATH in the "Environment" page, then the user
thinks it is for all program types. Or sould the "Environment"
page be disabled if the object is a DOS program?

jl>> - how the info written in the "Environment" page
should be saved?

PF> Hmmm;  I'd say in an EA attached to the exe -- that way,  when the exe
PF> is erased, the env data goes with it.

Very good idea! I was thinking only INI-files...

I'll try to implement these ideas during holidays (unless DevCon 9 arrives
:-) and if you give me your internet address I'll send the source code to
you so that you can compile and test it yourself.

        // Albert  (Team OS/2)         email: jla{at}to.icl.fi

--- GoldED/2 2.50
* Origin: Finland, Ice Hockey World Champion '95 (2:221/360.20)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 808 809 934 955 712/407 515
SEEN-BY: 712/517 628 713/888 800/1 7877/2809
@PATH: 221/360 0 220/841 201/2104 109/347 716 13/25 396/1 270/101 712/515
@PATH: 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™.