Windows 7 + fullscreen OpenGL + Modal dialogs pb


Since I switched to Win7 as a development environment, and a possible target platform for my applications, I noticed a regression in their behaviour.

Whenever I have a fullscreen window containing a fullscreen OpenGL context, the applications have problems displaying modal dialog boxes (such as message boxes, file open dialog, etc.)

The window is just created with WS_POPUP style. The GL context is nothing fancy. And everything is fine with Windows XP.

The problem under Windows 7 is that the modal dialog boxes are invisible at their opening (maybe their appear behind the full screen window). You have to Alt-Tab the application to have the dialogs appear.

This is a major problem as the application appears to be frozen, while it in fact waits for user input.

Did anyone encounter this behaviour ? Does anyone know a workaround ?

I’ve quickly made up a sample test application ; its source code can be found at A simple MSVC8 project can be found here.


The solution I found for this problem was to ensure that the pixel format for the window uses the WGL_SWAP_COPY_ARB swap method rather than the WGL_SWAP_EXCHANGE_ARB.


Thanks Joseph, a workaround would be a good news ! I don’t have access to my Win7 machine right now, I’ll give it a try asap !

Did you see any performance impact by changing the swap method ?

Thanks again,

Ok, I’ve made a test, and I managed to have the behaviour you describe.

I’ve noted that one must use ‘wglChoosePixelFormatARB’ to obtain the pixel format.

I tried with the classic ‘ChoosePixelFormat’ with the ‘PFD_SWAP_COPY’ flag, but it does not work on my system (Win7 x64 + NVidia GeFo 9600GT v196.21) as it always returns me a pixel format with ‘PFD_SWAP_EXCHANGE’ instead.

I’m only half-happy with the results, as it introduces some tearing in my display, but as least it works !

For reference, I’ve updated my test source code.

Thanks a lot Joseph !

Bad news, I switched my dev platform to an ATI Radeon HD 5770 + Catalyst 10.2 and the workaround is not effective.

It seems that the ‘PFD_SWAP_COPY’ trick only works on NVidia.

On my ATI setup, the problem is even worse as the modal dialog ‘freezes’ the whole system : Alt-Tab does nothing, the Windows-key does not show the start menu ; I have to press Ctrl-Alt-Suppr to have the modal dialog display correctly.



Do you know this article?

Maybe it has some useful information to your problem.

Thanks for the tip, but I did know it : I was looking at it closely yesterday and tried various combinations of PFD_ flags, and WS_ styles without much success.

The WM_PAINT and WM_ERASEBKGND messages do not apply in my case though.

Moreover, our apps worked flawlessly on Vista, it’s a new Win7 behaviour that’s bugging us…