[comp.windows.ms] Launching Windows apps from DOS box.

schansen@amc-gw.amc.com (Scott Hansen) (03/22/91)

In article <1991Mar15.084619.16265@ecn.nl> rijnsburger@ecn.UUCP
(Wim Rijnsburger) writes:

>>I should like to know why Windows applications cannot be launched from
>>a DOS window. I know that Windows applications call a special function
>>if Windows is not present. But maybe there is a way to catch the situation
>>that Windows is up and running, while the DOS window is active?

From: alan@ukpoit.co.uk (Alan Barclay)
>WINVER does this. Don't know how though.


WINVER accomplishes it by using a custom STUB.EXE when the utility was
linked (I would assume).  The stub is what displays the error message
"This program requires Microsoft Windows", amoung other things.  

If you look at WINVER with some kind of hex editor, you will see the
message "Windows Version 3.00" is hardcoded in the executable, instead
of the standard error message.  So, it is not as smart is you think it
is, it just appears that way.

To accomplish what you want, the stub would have to:  Check to see if
Windows is running, if it is, EXIT the current DOS box and post a
message to the Windows system queue to launch the application.  If Windows
is not running, it would have to start Windows and pass the application's
binary executable filename as a command line argument.

Well, thats why and a generic how, but I'll leave the specifics up to the
Senior Windows Hacks, I'm still in Junior mode...

-Scott
-- 
==============================================================================
Scott Hansen (schansen@amc.com)           Sysop...:  The Crystal Chip 
Applied Microsystems Corporation          BBS.....:  (206) 226-6550    
Redmond, Washington  98073                Voice...:  (206) 882-5322

akm@cs.uoregon.edu (Anant Kartik Mithal) (03/22/91)

>>>I should like to know why Windows applications cannot be launched from
>>>a DOS window. I know that Windows applications call a special function
>>>if Windows is not present. But maybe there is a way to catch the situation
>>>that Windows is up and running, while the DOS window is active?
>From: alan@ukpoit.co.uk (Alan Barclay)
>WINVER does this. Don't know how though.

Actually, it doesn't... If you run winver from dos (no windows at all,
it behaves like a dos application. If you run it from windows, it
behaves like a windows application. If you run it from a dos shell
within windows, it behaves like a dos application... Setup.exe does
the same thing.

There was a good explanation by someone about why winver running in a
dos shell can't figure out that windows is running, and how it would
be up to the shell (e.g. command.com / 4dos to do the needful...)

kartik



--
Anant Kartik Mithal                                     akm@cs.uoregon.edu
Research Assistant, 					(503)346-4408 (msgs)
Department of Computer Science,                         (503)346-3989 (direct)
University of Oregon, Eugene, OR 97403-1202