Terminating an Application

A Presentation Manager application is normally terminated by a message of the class WM_QUIT being posted to the application's message queue. The message may be posted by any window procedure or subroutine within the application, or by Presentation Manager as the result of the user selecting the "Shutdown" option from the Presentation Manager desktop. The message may result from the user selecting an "Exit" option from the menu bar, or selecting the "Close" option in the system menu of the application's main window.

The WM_QUIT message causes the next WinGetMsg() call to return FALSE. This in turn causes the application's message processing loop to terminate.

By convention, a Presentation Manager application performs standard termination processing such as:

  • Destroying the application's main window

  • Destroying the application's message queue

  • Deregistering the application from Presentation Manager.

    The application may additionally perform its own termination functions such as closing or destroying any global data objects. Secondary threads are normally terminated from within the window procedure that created them, as part of that window procedure's WM_DESTROY message processing. See Multitasking Considerations for further information.


    [Back: External Macros]
    [Next: Summary]