View Full Version : in MDI in MDI how do I get correct DC

11-22-2002, 04:08 PM
m_hgldc = ::GetDC(m_hWnd);
if(!SetPixelformat(m_hgldc)) // set pixel format
::MessageBox(::GetFocus(),"SetPixelformat Failed!","Error",MB_OK);


When I try to OpenGL SwapBackBuffer the whole screen goes black, this code works with one window. But not MDI. Can someone help me, much thanks and God bless ya.

11-22-2002, 04:10 PM
Oh and its in MFC.

11-25-2002, 04:28 AM
Do you have that code in the CView derived classes?

Also, be sure and use wglMakeCurrent when you redraw the scenes for each CView.

Also, you should make sure that in the PreCreateWindow, you create a new window class to use which has the CS_OWNDC flag set.