[comp.windows.ms] Detecting Windows

bcw@rti.rti.org (Bruce Wright) (03/23/90)

Does anyone know of a reliable way for a traditional app to tell if it
is running in a window under Windows?  Since you can't do direct
screen writes under Windows from such an app (as well as other
restrictions), it would be "nice" to make it fall back to using the
ANSI terminal driver which exists when you are running in a window,
and write directly to the screen when you are running in DOS.

I know you can use a PIF file to tell Windows that the app writes to
the screen memory.  I don't want to do that - I'd rather run in a real
window rather than have to switch back and forth to full screen mode.

I know I could convert the old apps to run under Windows as real
Windows apps, but this is a lot of pain, and although they are still
in use (and I have written Windows apps before) the amount of use 
doesn't justify that amount of pain.

The old apps are organized in such a way that it would be pretty easy
to just have some of the initialization code check for running under
Windows and if so, to use the ANSI escape sequences (they already have
code to deal with ANSI.SYS, they just need some way to tell whether to
activate the ANSI output driver or the direct screen output driver).
I can make them work fine if I specify explicitly on the command line
to use the ANSI driver - but I want them to do this automagically.

Please don't tell me to look through memory for code that looks like
it's Windows code - I don't consider that a reliable way of checking
the display environment.

						Bruce C. Wright