Jump to content
  • Advertisement
Sign in to follow this  
SirMalder

Need help. Fullscreen D3D window loses focus

This topic is 4074 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

Please advice. We discovered unpleasant problem with our fullscreen Direct 3D 8.1 application on some PCs under Windows XP SP2. Sometimes our 3D window loses focus. 1) In Windows Explorer we start our GDI application (launcher). 2) In launcher we click a button. 3) Fullscreen 3D application starts and its main window gets WM_ACTIVATE 4) Now launcher automatically exits (right after it started 3D application). 5) And at this moment window of 3D application loses focus, although it didn't receive WM_DEACTIVATE and fullscreen 3D still works. However GetForegroundWindow says that my 3D window not focused anymore. And when I type something on the keyboard, key pressings translates to Windows Explorer, instead of window of my 3D application! Please advice how to solve this problem and make my 3D application keep focus. I don't understand why Windows decided to move focus from 3D application to another application. (Attempt to call SetForegroundWindow after losing of the focus doesn't help.) Thanks in advance,

Share this post


Link to post
Share on other sites
Advertisement
There are a few API functions you can use to make sure your app is topmost and in focus and activated (ready for input).

SetForegroundWindow(), SetFocus() and SetActiveWindow(). Also make sure your DirectX app's window is topmost. SetWindowPos() along with HWND_TOPMOST will make sure it won't lose focus (unless someone ALT-TAB etc)

Share this post


Link to post
Share on other sites
Thank you for the response!

Of course, we know about these moments and we do so.
But it didn't help in this case.

We found solution for this problem. If after when laucher started 3D application we hide window of launcher, and add Sleep(2000) and only after this close launcher, focus will be leaved on window of 3D application as we want.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!