Sign in to follow this  

Need help. Fullscreen D3D window loses focus

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

This topic is 3859 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this