Modal dialogs opened by the full-screen OpenGL window in Windows 7 are not displayed

It seems that my problem may be the same as an unanswered question ( OpenGL with GLUT in Windows 7, full-screen mode not displaying a message box ).

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

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

A window is only created using the WS_POPUP style. The GL context does not represent anything. And everything is fine with Windows XP.

The problem with Windows 7 is that the modal dialogs are invisible when they open (maybe they appear behind a full-screen window). You have an Alt-Tab application for displaying dialogs.

This is a serious problem because the application seems to be frozen while it is actually waiting for user input.

Has anyone encountered this behavior? Does anyone know a workaround?

I quickly compiled a sample test application; its source code can be found at http://pastebin.com/K4v2NNDs . A simple MSVC8 project can be found here .

PS. I also posted on the opengl.org forums, I apologize for those of you who follow both.

EDIT

Thanks to Chris comment, I checked the modal dialog for various events like WM_TIMER or WM_RBUTTONUP, but the problem still exists.

I also called "DwmEnableComposition" with "DWM_EC_DISABLECOMPOSITION" to check: the problem still exists.

I also tested the application by replacing the OpenGL bit with DirectX, and thus everything works as expected ... This is really an OpenGL problem causing the problem.

(updated pastebin http://pastebin.com/Rq1Ehm3w and my notepad)

EDIT

The problem also exists in Windows 8.

0
source share
4 answers

A workaround was posted on opengl.org by Joseph Steel, so I also added it for reference:

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

I noticed that to get the pixel format you need to use 'wglChoosePixelFormatARB'.

I tried with the classic "SelectPixelFormat" with the flag "PFD_SWAP_COPY", but it does not work on my system (Win7 x64 + NVidia GeFo 9600GT v196.21), since it always returns me the pixel format using "PFD_SWAP_EXCHANGE".

I am only a little satisfied with the results, as this leads to some gap on my display, but at least it works!

For reference, I updated the source code.

EDIT, dec.2013

This workaround no longer works, at least on my system (Optimus GeForce 650M laptop). WGL_SWAP_COPY_ARB is configured, but the modal dialog is not displayed. So far, it seems that creating a window with 1 pixel border (adding the WS_BORDER style to WS_POPUP) does the trick and prevents you from entering full-screen mode.

+1
source

The solution to my system was pretty simple: - DO NOT specify the WS_POPUP style when creating the window. - As soon as you get hwnd, reset your window styles to what you want (but not WS_POPUP again) using SetWindowLong (hwnd, GWL_STYLE, yr_styles);

0
source

I had the same problem with OpenGL under Win7 64 bit. Modal dialog boxes and modal windows are not displayed, and they are also active in the background. My project used a stereo display (ATVs). In my case, the problem was caused by incorrect settings on the control panel of the display adapter (Nvidia Quadro FX3800). The setting was "Stereo Enabled", which was incorrectly disabled. By turning it on, you have solved the problem.

0
source

when I want, for example, to open filedialog in full-screen OpenGL mode (Windows10 or before each Windows), I call

RedrawWindow (hwnd, 0, 0, RDW_INTERNALPAINT);

(this causes the WM_PAINT message to be sent to the window, regardless of whether any part of the window is invalid)

and right after that I call filedialog. Now filedialog will be shown in full screen OpenGL mode.

In WndProc, inside the WM_PAINT case: I am doing SwapBuffers (hdc)

RedrawWindow(hwnd, 0, 0, RDW_INTERNALPAINT); // important when fullscreen; forces a WM_PAINT message, GLwin->Fileselect(s_fname); // or whatever dialog LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lparam) { switch(message) { case WM_PAINT: SwapBuffers(hdc); // (same as in the render-loop) break; 
0
source

All Articles