Programming |  Windows Programming |  A C++ wrapper for window

It's handy to create a c++ class that contains everything needed for a particular window. It would contain all the data that needs to be retained while the program is active, and methods to handle any windows messages that need to be dealt with.

Any information about a window that you give to windows (icon, position, etc), doesn't need to be saved in the class, because windows has it, and it can be retrieved as needed. The exception would be something that is needed so often that the function calls to retrieve and set it affects program performance.

The best way to connect the class instance to the window is to save a pointer to it in the windows extra bytes (that you allocated).

There are four ways to handle the connecting the class instance to the window.

Steps:

1) create an instance of the c++ window class.

2) register the windows window class.

3) create the window.

4) ShowWindow()

5) UpdateWindow()