PDA

View Full Version : Error&Workaround: Unable to create OpenGL creation query window



McBen
04-04-2009, 04:25 PM
ClanLib 9.0 rev2792

I tried to build and run the "basic2d" example.
But on my System (vista32, Studio08 prof.) it always throws "Unable to create OpenGL creation query window".

After some investigation I figured out that in "CL_OpenGLCreationHelper" "CreateWindowEx" returns a 'invalid parameter' error.
Debugging shows in my case the "window_info.dwExStyle" was 0x20000900
There wasn't a reference in winuser.h for the 0x20000000 or the 0x00000800 flag so removed the extrastyle completely.
And it worked :)

oh and I replaced (after that) the "WS_VISIBLE if"

Index: opengl_creation_helper.cpp
================================================== =================
--- opengl_creation_helper.cpp (revision 2792)
+++ opengl_creation_helper.cpp (working copy)
@@ -39,11 +39,10 @@
memset(&window_info, 0, sizeof(WINDOWINFO));
window_info.cbSize = sizeof(WINDOWINFO);
GetWindowInfo(window, &window_info);
- if (window_info.dwStyle & WS_VISIBLE)
- window_info.dwStyle -= WS_VISIBLE;
+ window_info.dwStyle &= ~WS_VISIBLE;

query_window = CreateWindowEx(
- window_info.dwExStyle,
+ 0,//window_info.dwExStyle,
WC_STATIC,
TEXT(""),
window_info.dwStyle,


Maybe there is a better solution without trashing the extra-style. At least this is a workaround for my system :rolleyes:

Magnus Norddahl
04-04-2009, 07:20 PM
Thanks for taking your time to trace down this bug.

I've applied your changes, although slightly modified so it specifies 0 and WS_CHILD so there can't be other combinations where it fails.

sphair
04-07-2009, 06:05 PM
I'm getting problems with this latest change on my ATI laptop.

CreateWindowEx fails, and GetLastError reports back: ERROR_TLW_WITH_WSCHILD 1406 Cannot create a top-level child window.

Magnus Norddahl
04-08-2009, 05:41 PM
Oops, maybe I should actually have tested it before committing. :)

Made a new commit that should be fixing it properly this time. At least it is now confirmed to work on my computer.