previous next

The Main Procedure of a PM Program

PM_App: Proc Options( Main );

dcl hab HAB;
dcl hmq HMQ;
dcl qmsg QMSG;
dcl ( hwndFrame, hwndClient ) HWND;
dcl flags fixed bin( 31 ) static nonasgn init( ior(   FCF_TITLEBAR, FCF_SIZEBORDER, FCF_SYSMENU, FCF_MINMAX, FCF_SHELLPOSITION ) );

hab = WinInitialize( 0 );
hmq = WinCreateMsgQueue( hab, 0 );
hwndFrame = WinCreateStdWindow( HWND_DESKTOP, WS_VISIBLE, flags, null(), "title  text",   0, null(), ID_MAINWND, hwndClient );
do while ( WinGetMsg( hab, addr( qmsg ), null(), 0,0 ) ¬= 0 );
Call WinDispatchMsg( hab, addr( qmsg ) );
end;
Call WinDestroyWindow( hwndFrame );
Call WinDestroyMsgQueue( hmq );
Call WinTerminate( hab );

 END;