virtual BOOL PreCreateWindow( CREATESTRUCT & cs );


cs a CREATESTRUCT structure used for the window creation

Return Value

Nonzero if the window creation should continue; 0 to indicate creation failure.


Pass MFC object’s PreCreateWindow function call to the COpenGL object’s PreCreateWindow method function call. The PreCreateWindow function modifies the given CREATESTRUCT structure. It ensures that all parameters OpenGL requires will be correctly set.

Note: The window intended for OpenGL output must not include CS_PARENTDC for the class style.


class COglSampleView : public CView
  // specify operations or attributes as desired …

  COpenGL     m_OpenGL;
  // specify operations or attributes as desired …

BOOL COglSampleView::PreCreateWindow(CREATESTRUCT& cs)
  // Modify the Window class or styles here by modifying
  //  the CREATESTRUCT cs
  if ( 0 == CView::PreCreateWindow(cs) )
           return 0;
  // pass PreCreateWindow processing to COpenGL object
  return m_OpenGL.PreCreateWindow( cs );

See Also

OnCreate, OnDestroy