Declaring a Message-structure Type

From RAD Studio
Jump to: navigation, search

Go Up to Defining Your Own Messages


If you want to give useful names to the parameters of your message, you need to declare a message-record type for that message. The message-record is the type of the parameter passed to the message-handling method. If you do not use the parameters of the message, or if you want to use the old-style parameter notation (wParam, lParam, and so on), you can use the default message-record, TMessage.

To declare a message-record type, follow these conventions:

  1. Name the record type after the message, preceded by a T.
  2. Call the first field in the record Msg, of type TMsgParam.
  3. Define the next two bytes to correspond to the Word parameter, and the next two bytes as unused. Or Define the next four bytes to correspond to the Longint parameter.
  4. Add a final field called Result, of type Longint.

See Also