HP Integrity NonStop J-Series User Manual
Page 264

}
/*
* The callback routine for this window class.
*/
long FAR PASCAL _export
DemoWindow_Callback(HWND hWnd, unsigned iMessage, //16
WPARAM wParam, LPARAM lParam)
{
DemoWindow* pDemoWindow;
if( iMessage==WM_CREATE ){ //17
// Get the "this" pointer out of the create structure
// and put it in the windows instance:
LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
pDemoWindow = (DemoWindow*) lpcs->lpCreateParams;
RWSetWindowPtr(hWnd, pDemoWindow);
return NULL;
}
// Get the appropriate "this" pointer
pDemoWindow = RWGetWindowPtr(hWnd); //18
switch( iMessage ){
case WM_PAINT:
pDemoWindow->paint(); //19
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return DefWindowProc(hWnd, iMessage, wParam, lParam);
};
return NULL;
}
void RWSetWindowPtr(HWND h, DemoWindow* p){ //20
SetWindowLong(h, 0, (LONG)p);
}
DemoWindow* RWGetWindowPtr(HWND h){ //21
return (DemoWindow*)GetWindowLong(h, 0);
}