To derive custom classes from the COpenGLWnd class

To derive a custom class from the COpenGLWnd class follow these steps: ( the following instructions are valid for the Microsoft Developer Studio 4.0 )

1.Activate the MFC ClassWizard application from the Visual C++ development environment
2.Choose the MFC ClassWizard ‘Add class…’ button
3.Choose the ‘New…’ menu item
4..Type a name of the class you are creating
5.Choose the ‘generic CWnd’ as the Base class
6.Choose the other ‘Create New Class’ dialog parameters as desired
7.Insert ‘#include “MfcClassGL.h’ line into your class header file
8.Modify the ‘class <Your Own Class> : public CWnd’ line in your class header file to the ‘class <Your Own Class> : public COpenGLWnd’.
9.Modify the ‘BEGIN_MESSAGE_MAP(<Your Own Class> , CWnd)’ line in your class .cpp file to the ‘ BEGIN_MESSAGE_MAP(<Your Own Class> , COpenGLWnd)

Note:Add the MfcClassGL.cpp file to your application project to allow deriving custom classes from the COpenGLWnd class. The MfcClassGL.cpp file implements the COpenGLWnd class. The MfcClassGL.cpp and MfcClassGL.h files are available in the OglSample sample application source code

See Also

COpenGLWnd, COpenGL