52875.fb2
Anyone familiar with the Win32 API knows that the process for creating windows is rather lengthy: you create a WNDCLASSEX structure, initialize its members and register it (per window class); create the window, check for the validity of the returned handle, and finally display the window. Of course, I neglected to mention that initializing the WNDCLASSEX structures members requires that you define a window procedure first…
So it's logical that the enterprising C++ developer would like to wrap all of the above in a nice class that would allow her write something like:
Window *wnd = new Window(…);
wnd->Create(…);
wnd->Show(…);
// use window
// window's destructor is automatically called, and
// performs necessary cleanup
Doesn't look to hard… Ha! it took me a good 2 hours to perfect the object association and proper message pump termination. I'll share my design principles, implementation, revisions and discoveries in the process of creating this wrapper class. I will not be covering the fundamentals of creating windows with Win32, or any other technology I consider to be elementary. There are several good references available on the web for these topics; please take advantage of them.
Without further ado, let's dive in!