beautypg.com

HP Integrity NonStop J-Series User Manual

Page 262

background image

DemoWindow* RWGetWindowPtr(HWND h);
void RWSetWindowPtr(HWND h, DemoWindow* p);

#endif

The demowind.cpp File

Now let's look at the definitions of the public functions of class DemoWindow: the
DemoWindow constructor, the DemoWindow destructor, and the member functions insert(),
registerClass(), and paint(). Detailed comments follow this listing.

#include
#include
#include "demowind.h"
#include "shapes.h"
#include
#include

/*
* Construct a new window.
*/
DemoWindow::DemoWindow( HINSTANCE mom, HINSTANCE prev,
int cmdShow) //1
{
myInstance = mom;
nCmdShow = cmdShow;

// Register the class if there was no previous instance:
if(!prev) registerClass(); //2

hWnd = CreateWindow("DemoWindow", //3
"DemoWindow",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
CW_USEDEFAULT, 0,
NULL,
NULL,
myInstance,
(LPSTR)this ); // Stash away 'this' //4

if(!hWnd) exit( FALSE );
}

/*
* Register self. Called once only.

This manual is related to the following products: