Example of Message Structure
Go Up to Defining Your Own Messages
For example, here is the message record for all mouse messages, TWMMouse, which uses a variant record to define two sets of names for the same parameters.
TWMMouse = record
Msg: Cardinal;
MsgFiller: TDWordFiller; ( first is the message ID )
Keys: Longint; ( this is the wParam )
KeysFiller: TDWordFiller;
case Integer of ( two ways to look at the lParam )
0: (
XPos: Smallint; ( either as x- and y-coordinates...)
YPos: Smallint;
XYPosFiller: TDWordFiller;);
1: (
Pos: TSmallPoint; ( ... or as a single point )
PosFiller: TDWordFiller;
Result: LRESULT); ( and finally, the result field )
end;
TWMKey = record Msg: Cardinal; // first parameter is the message ID MsgFiller: TDWordFiller; // this is the first wParam CharCode: Word; Unused: Word; CharCodeUnusedFiller: TDWordFiller; KeyData: Longint; // this is the lParam KeyDataFiller: TDWordFiller; Result: LRESULT; // this is the result data member end;