PDA

View Full Version : GDI32.dll: Access violation



Leva
01-20-2005, 09:01 PM
In windows 98 SE. I create "fullscreen" window with WS_EX_APPWINDOW flag. Then I choose pixel format and create OpenGL context. After window is closed I release OGL context. Very often I 1-1000 access violations in GDI32.dll. I even download some examples from internet and they operate the same way and I get the same bug. What I do wrong?
I used GeForce FX and Radeon 9600XT video cards. And the last drivers.

jide
01-21-2005, 02:53 AM
This might best stands in the Windows specific forum.

zeckensack
01-21-2005, 03:45 AM
You should release your GL context and the device context (hdc) before calling DestroyWindow.

Your windows class should have the CS_OWNDC style. This way you can get the device context once, immediately after creating the windows, and keep it around until you close it.

Order matters. Initialization:
1)CreateWindow(Ex)
2)GetDC
3)ChoosePixelFormat, SetPixelFormat
4)wglCreateContext
5)wglMakeCurrent

Shutdown:
1)wglMakeCurrent(0,0)
2)wglDeleteContext
3)ReleaseDC
4)DestroyWindow