Structure of an Application's Main Routine
int main()
{
    <Global data declarations>
    hAB   = WinInitialize(...);           /* Register application   */
    hMsgQ = WinCreateMsgQueue(...);       /* Create message queue   */
    WinRegisterClass(...);                /* Register window class  */
              :
    hFrame  = WinCreateWindow(...);       /* Create frame window    */
    hClient = WinCreateWindow(...);       /* Create client window   */
    WinAddSwitchEntry(...);               /* Add task manager entry */
    while (WinGetMsg(...))                /* Loop until WM_QUIT     */
          WinDispatchMsg(...);
    WinRemoveSwitchEntry(...);            /* Remove task mgr entry  */
    WinDestroyWindow(hFrame);             /* Destroy main window    */
    WinDestroyMsgQueue(hMsgQ);            /* Destroy message queue  */
    WinTerminate(hAB);                    /* Deregister application */
}
[Back: Message Flow in a Presentation Manager Application] 
[Next: Structure of a Window Procedure]