View Full Version : Access Violation in GDI32.dll

01-03-2002, 05:19 PM
Hi everyone.
I've been messing around with OpenGL for a while, and very rarely upon running my program (in the debugger), I get this error:
'Access Violation at address 0xBFF24DD5'
streaming in the program log (Codewarrior is the compiler I use). Its not a crash - the program still executes as expected.
When I enable catching the Access Violation exception, the stack trace says it is happening in GDI32.DLL.
That last call from my code (from the stack)comes in WinMain, in the funtion
EnableOpenGL( hWnd, &hDC, &hRC );
From there it jumps into GDI32.DLL->OPENGL32.DLL->KERNEL32.DLL->GDI32.DLL where it happens.

Im wondering if anyone knows what this is. Im not doing anything crazy in code (that I know of :-) - basically its just cut and pasted from examples on the net. Here is that init code for reference )

Thanks in advance. Sorry for the lengthly post, I tried to keep it short and still get the problem across. :-)

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
HWND hWnd;
MSG msg;

// register window class
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = "GLSample";
RegisterClass( &wc );

// create main window
hWnd = CreateWindow(
"GLSample", "OpenGL Sample",
0, 0, 640, 480,
NULL, NULL, hInstance, NULL );

// enable OpenGL for the window
EnableOpenGL( hWnd, &hDC, &hRC );

// ...

01-03-2002, 06:19 PM
Unfortunately this is normal behavior on Win9x (I'd guess also on WinMe). You can safely ignore those messages.