HP Integrity NonStop J-Series User Manual
Page 260

Tools.h++ DLL.
/*
* Sample Windows 3.X program, using the Tools.h++ DLL.
*/
#include "demowind.h"
int PASCAL
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR , int nCmdShow) // 1
{ // Create an instance of the "DemoWindow" class:
DemoWindow ww(hInstance, hPrevInstance, nCmdShow); // 2
// Add some items to it:
ww.insert( new RWRectangle(200, 50, 250, 100)); // 3
ww.insert( new RWEllipse(50, 50, 100, 100));
ww.insert( new RWText(20, 20, "Hello world, from Rogue
Wave!"));
ww.show(); // Show the window // 4
ww.update(); // Update the window
// Enter the message loop:
MSG msg;
while( GetMessage( &msg, NULL, 0, 0)) // 5
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return msg.wParam; // 6
}
Here's the line-by-line description of the program.
//1 This is the Windows program entry point that every Windows program must have. It is
equivalent to C's main function.
//2 This creates an instance of the class DemoWindow, which we will see later. It represents an
abstract window into which objects can be inserted.
//3 Here we insert three different objects into the DemoWindow: a rectangle, an ellipse, and a
text string.
//4 This tells the DemoWindow to show itself and to update itself.
//5 Finally, the windows main event loop is entered.
//6 The DemoWindow destructor frees all memory allocated for its window objects.