Messages are grouped into message classes, with each class representing a particular type of event such as character input, mouse movement, etc. Many message classes are defined by Presentation Manager, and messages of these classes are usually dispatched by Presentation Manager to inform an application of system-initiated events. These system-defined message classes are described, along with the default processing provided by Presentation Manager for each class, in the IBM OS/2 Version 2.0 Presentation Manager Reference.
An application developer may define additional message classes unique to his or her particular application, for use by that application. Application-defined messages typically serve as a means of communication between windows, where one window passes information to another window, for processing by the window procedure associated with that window. The destination window may then return a message to the calling window indicating completion, or may pass a message to a third window to trigger an additional action, dependent upon the requirements and design of the application.
For example, the user may elect to update a file by selecting an item from a menu bar. The window procedure associated with the display window to which the menu bar belongs may pass a message to an object window associated with the file to be updated. The window procedure for this window would make the change and then pass a message to a third object window, which logs the update before passing a message back to the original window procedure indicating that the update is complete.
Note that message classes need not be specific to a particular window class; messages of the same class may be passed to different window classes, with different results depending upon the processing of that message by the window procedure belonging to that window class. This is in accordance with the object-oriented principle of polymorphism.