Getting notified when fullscreen mode is interrupted

Started by
2 comments, last by 21st Century Moose 10 years, 8 months ago

hi, i use DX11 to bring my game into an exclusive fullscreen mode.

i want to handle the events, when the fullscreen mode is interrupted by the OS. like when alt+tab is pressed, or ctrl+alt+del.

is there an event on the Window or the WindowHandle where i can subscribe to?

Advertisement

You might want to use GetForegroundWindow() and compare the result with your window handle.

In your windows message loop, you can listen for events of type "WM_ACTIVATE" and "wParam == WA_INACTIVE".

See the msn documentation for details.

This will solve only part of your problem though, because it won't work for all the possible cases:

  • For alt-tab and windows-key, you will receive a WM_ACTIVATE event.
  • For ctrl+alt+del and lock screen (windows-key + L) you will not receive an event.

So, if you really want to catch all possible cases where your fullscreen mode is interrupted, you have to do what Medo3337 pointed out:

In regular time intervals, actively check the state of your window and/or your display device. This might seem inconvenient, but I have found no better way.

You may also wish to test the return value from your Present call for DXGI_STATUS_OCCLUDED which should happen if another window is occluding the game window.

Further reading: IDXGISwapChain::Present http://msdn.microsoft.com/en-us/library/windows/desktop/bb174576%28v=vs.85%29.aspx

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement