previous next

The Main Procedure of a PM Program

void main( void )
{
HAB hab;
HMQ hmq;
QMSG qmsg;
HWND hwndFrame hwndClient;
ULONG ulFrameContents = FCF_TITLEBAR | FCF_SIZEBORDER | FCF_SYSMENU | FCF_MINMAX | FCF_SHELLPOSITION;

hab = WinInitialize( NULL );
hmg = WinCreateMsgQueue( hab, 0 );
hwndFrame = WinCreateStdWindow( HWND_DESKTOP, WS_VISIBLE, &ulFrameContents, NULL, "Title text", 0L, NULL, ID_MAINWND,
hwndClient );
while ( WinGetMsg( hab, &qmsg, NULL, 0, 0 ) != FALSE )
{
WinDispatchMsg( hab, &qmsg );
}
WinDestroyWindow( hwndFrame );
WinDestroyMsgQueue( hmq );
WinTerminate( hab );
exit( 0 );
}