OpenGL app loses focus in fullscreen


on Windows 7 SOMETIMES (not always) during fullscreen
switch (where Aero disabled) the app loses its focus
although the fullscreen window is still displayed
in foreground.

Then Windows own mouse cursor appears in front of
the OpenGL fullscreen window and a mouse click
makes the app disappear (another window or the
desktop is shown).

This is really annoying and I can’t do anything
about it, I tried SetForegroundWindow() or

I guess sometimes during the Aero disable process
something goes wrong and removes the input focus
from the OpenGL app.

I have the latest NVidia drivers for my 8800 GTS
installed and my OS is Windows 7 x64.

Any ideas? :frowning:


i got this problem too on vista :eek:

I tried a lot of things to sovle this problem
but without luck. I just can’t do anything
about it :frowning:

Make sure the window is HWND_TOPMOST (SetWindowPos).

Thanks for the hint!

I’ll give it a try with the WS_EX_TOPMOST flag :slight_smile:
Should be the same like SetWindowPos().


if (Fullscreen) dwStyleEx|= WS_EX_TOPMOST;

Window_Handle_Main= CreateWindowEx(dwStyleEx, ...);

I’ll report if the problem still exist.

Also, you can inform system that screen saver is running (your application will then be considered to be a screensaver) - this stops a few things from happening.

I’m not doing so though - since I never had problems (I use TOPMOST), but I will probably add it as option.

Make sure the nVidia control panel is closed. It steals the focus occasionally. Very annoying.