Validate Rect causing Acess Violation

Im writing a OPenGL app in MFC. It is a SDI with an openGL context. All works fine in Debug mode sop far but i get the message

First-chance exception in OpenGL_MFC_.exe (GDI32.DLL): 0xC0000005: Access Violation.

when ValidateRect(NULL); is called in the OnPaint() Function. The message is ignored in debug mode and everything draws properly but the Release version doesnt allow it - obviously i need to resolve this, any ideas?

Thanks for any help.


Hi !

I have no idea about the crash, but why call ValidateRect in the paint method, BeginPaint validates it for you so you don’t need to do it.