Jump to content
  • Advertisement
Sign in to follow this  
stenny

Disabled windows (WinAPI)

This topic is 3631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heya! When I'm running fullscreen (style: WS_POPUP), and press with Windowsbutton on my keyboard, the startmenu pops up, but the window is still drawn in the background. How can I disable my app when for example that button is used, alt-tab is pressed or - in windowed mode - the minimize button is pressed? Lots of thanks, - Stijn

Share this post


Link to post
Share on other sites
Advertisement
The WM_ACTIVATE can tell you if your window is being deactivated or reactivated, is that what you're after?

Share this post


Link to post
Share on other sites
Quote:
Original post by jpetrie
The WM_ACTIVATE can tell you if your window is being deactivated or reactivated, is that what you're after?

That sounds like it. I'll have a look, thanks!

[EDIT]
Hmm...looks right, but how can I stop my window from being drawn? I tried ShowWindow(SW_HIDE), but that also removes the window from the taskbar.

Share this post


Link to post
Share on other sites
Maybe you can minimize the application programatically
by calling:

BOOL ShowWindow(HWND hWnd, int nCmdShow);

nCmdShow should be SW_MINIMIZE.

hopefully this works.



Share this post


Link to post
Share on other sites
Quote:

Hmm...looks right, but how can I stop my window from being drawn?

Well, you draw the window right? Set state when you become deactivated / minimized, and gate your rendering on that state as appropriate (for example, a boolean flag somewhere).

You shouldn't make the window vanish entirely based purely on activate/deactivate, as this will be extremely jarring for users -- making any other window have the focus will hide your window, which is poor user experience. You can listen for Windows messages that tell you you're being minimized and disable your rendering there, as it makes little sense to actually draw when you are not on the screen at all.

Share this post


Link to post
Share on other sites
Processing WM_ACTIVATE is a little dangerous because DefProcWindow(..) function processes many thing in this message, so a boolean is more usable i think.

Share this post


Link to post
Share on other sites
WS_POPUP by itself is not fullscreen. Are you really using Fullscreen (ie. DirectDraw or Direct3d or ChangeDisplaySettings with according parameters set?)

If you're using true full screen proper lost device handling should solve that issue by itself. My games don't have any WM_ACTIVATE checking (only for toggling between busy and multi-app-friendly message pumping) for the window state. When the windows key is pressed the fullscreen apps automatically gets minimized without me doing that.

If you're using fake fullscreen (WS_POPUP with a full size window) you're really in windowed mode. In that case you have to code the wanted behaviour yourself.

Share this post


Link to post
Share on other sites
Some games stop their logic (and possibly rendering) calls until they are back in focus.

You do still need to handle lost devices though.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!