🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2433

Re: Lauching Windows Apps from Non-Windows Apps?

#2433
From: Ed Schwalenberg
Date: Sat, 04 May 1991 19:20
40 lines
2680 bytes
Dale Gass asks, "I am looking for information on how to launch Windows 3.0
Applications from non-windows application running in a Window."

This is really hard, because in 386Enhanced mode the DOS app and the
Windows world are in separate virtual machines; the only context they have
in common is the underlying DOS.  The basic idea is to use a TSR that
talks to both the DOS app and a Windows "wrapper" app that does the
WinExec for you.

Create a TSR that gets loaded before Windows is started.  Its services
will be available to both DOS apps and Windows apps.  When Windows
is started, your wrapper program can call the TSR with an INT 2F, giving
it the address of some GlobalDOSAlloc'ed memory which will be used to
pass information back and forth between the TSR and protected-mode Windows.
While processing this INT 2F, you issue one of your own, with AX=1683h,
which will return in BX the magic number of the Windows Virtual Machine,
which is currently 1 but may change.

The DOS application issues an INT 2F, passing the name of the desired
application to the TSR.  The TSR copies the information into a private
data buffer in the TSR's address space, NOT to the GlobalDOSAlloc'ed
memory (which only exists in the Windows virtual machine).

Now for the hard part.  You need to call back to Windows when the Windows
VM is scheduled.  To do that, use INT 2F, AX=1685h, BX=Windows VM number
which you saved from the initialization step, CX=flags, DS:SI = priority
boost and ES:DI = CS:IP of a procedure to call.  When the Windows VM is
scheduled, your procedure will be called.  That procedure can copy the
name of the application into the GlobalDOSAlloc'ed memory, issue an INT 2F
to the windows wrapper program, and IRET.  The windows wrapper program
can use the data in the GlobalDOSAlloc'ed memory to WinExec the desired
program.

Full documentation on these INT 2F functions are in Appendix D of the
Virtual Device Adaptation Guide, which is part of the DDK.

This is all based on my understanding of the documentation, not on real-
life experience.  I don't know what steps would vary if you were running
Windows in standard or real mode.  In short, I'm not an expert nor do
I offer warranties.
Technical Details
Message-ID: <1991May4.192030.669@odi.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!odi!ed
References: <1991May3.145130.5755@mks.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!odi!ed
From: ed@odi.com (Ed Schwalenberg)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Lauching Windows Apps from Non-Windows Apps?
Message-ID: <1991May4.192030.669@odi.com>
Date: 4 May 91 19:20:30 GMT
References: <1991May3.145130.5755@mks.com>
Organization: Object Design, Inc.
Lines: 40
In-Reply-To: dale@mks.com's message of 3 May 91 14:51:30 GMT