[comp.windows.ms.programmer] Detecting Full-screen DOS apps

nee@cf_su14.Salomon.Com (Robert Nee) (12/14/90)

I have a question for all of you experts.  How can I determine if
a DOS application is running full screen under windows.  I am
writing a windows program that opens a window in the background but
I need to be able to determine if the user is in a full screen DOS
session first to prevent from dumping him back into windows.

I know how to check if the active window is a DOS window, by checking
it's class name.  I'm stumped after that.

Any help would be appreciated.  Thanks.

Robert Nee

davidds@microsoft.UUCP (David D'SOUZA) (12/26/90)

In article <140@cf_su20.cf_su10.Sbi.COM> nee@cf_su14.Salomon.Com (Robert Nee) writes:
>
>I have a question for all of you experts.  How can I determine if
>a DOS application is running full screen under windows.  I am
>writing a windows program that opens a window in the background but
>I need to be able to determine if the user is in a full screen DOS
>session first to prevent from dumping him back into windows.

Actually, the problem is more general that you expect.  Say the user is
typing into a database Windows apps.  I have entered the first 4 digits
into a phone number field. Now, your app suddenly (say on a WM_TIMER
message) brings up some "random" window. It takes the focus/activation
away from the data base and puts it to your window.

Well, lots of apps do data validation on the field when they lose the
focus. And then they put up a messagebox telling the user what went
wrong. And when the message box is dismissed, the focus/activations
then goes back to the telephone field.  This sort of thing really
confuses users just like suddenly getting kicked out of your dos box.

Or, say I am running a paint program and drawing something and suddenly
your window pops up over my work of art... Bizarre things happen...


Check out the way DOS boxes were implemented.  If you switch away from
them and they need to give you a message, they flash their icon at you
(and maybe MessageBeep also). Next time you alt-tab (or whatever) to
them, they display their message box at a more friendly time.

An alternative: Create your window invisible. Then use SetWindowPos to
position your window behind the currently active window
(GetActiveWindow()).  Then, use SetWindowPos SWP_SHOWWINDOW |
SWP_NOACTIVATE to show your window without activating it.  If your
window is reasonably small, you could probably get away with bringing
it on top of the currently active window as long as you don't activate
it. (Otherwise the user won't see anything if the foreground app is
maximized for example.)