Google Answers Logo
View Question
 
Q: Displaying a window on top of a directX surface ( No Answer,   1 Comment )
Question  
Subject: Displaying a window on top of a directX surface
Category: Computers > Programming
Asked by: harryh-ga
List Price: $50.00
Posted: 14 Nov 2002 14:37 PST
Expires: 14 Dec 2002 14:37 PST
Question ID: 107930
I need to display a window on the users screen when an event happens. 
Normally this is trivial, I just create a window with the always on
top property and call ShowWindow().

The problem is if there is a dirextX or openGL game running in full
screen mode.  In this case my window will not be seen by the user
until he quits his game (or Alt-Tabs out of his game).

How can I make sure that my window is ALWAYS displayed where the user
can see it?

-Harry

Request for Question Clarification by mmastrac-ga on 15 Nov 2002 16:38 PST
Have you tried sending a minimize message (SC_MINIMIZE) as follows:

http://www.bcbdev.com/faqs/faq3.htm

::SendMessage(::GetForgroundWindow(), WM_SYSCOMMAND, SC_MINIMIZE, 0);

Create your window, then use this method to minimize the currently
running application.

Detecting if an app is running fullscreen is harder!  You need to get
the current and registry video settings and compare them.  If they are
equal, you are running on the desktop, if not, an app has changed the
video mode:

See this MSDN link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_84oj.asp

DEVMODE dm1, dm2;
EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &dm1 );
EnumDisplaySettings( NULL, ENUM_REGISTRY_SETTINGS, &dm2 );

if ( dm1.dmBitsPerPel != dm2.dmBitsPerPel 
  || dm1.dmPelsWidth  != dm2.dmPelsWidth  
  || dm1.dmPelsHeight  != dm2.dmPelsHeight  
  || dm1.dmDisplayFlags  != dm2.dmDisplayFlags   
  || dm1.dmDisplayFrequency  != dm2.dmDisplayFrequency   )
{
     ::SendMessage(::GetForgroundWindow(), WM_SYSCOMMAND, SC_MINIMIZE,
0);
}

Please forgive my poor indentation - it's hard to paste code in here. 
:)

Let me know if this works!

Clarification of Question by harryh-ga on 15 Nov 2002 17:01 PST
Your suggestion to minimize the app would probobly work, but it is
unsuitable for me for 2 reasons:

1) MANY directX games have problems if you switch out of directX mode
and then back into it.

2) I really would like my notification to come up on top of the
currently running app, it will be a much better user experience.

My work so far has led me to look into replacing the message pump
process for the app that has taken over the screen (I can do this
using SetWindowLong()), and throwing up a dialog from there.  This
seems to only work some of the time though.  I suspect this has
something to do with the double buffering going on in the app i'm
testing against.  Also for DX8, it doesn't seem to work at all.

-Harry
Answer  
There is no answer at this time.

Comments  
Subject: Re: Displaying a window on top of a directX surface
From: alan_dershowitz-ga on 06 Dec 2002 14:00 PST
 
Take my comments with a grain of salt, I am new to DirectX. Just a
comment, not an answer.

I'd like to say that you probably couldn't do this, as exclusive is
_supposed_ to prevent this from happening.  That said, MSN Messenger
can often do it--incidentally, sometimes it doesn't seem to work, like
you are saying, and the double buffering makes the popup flicker like
crazy.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy