Using wParam and lParam Message Parameters in Delphi.Net

Because .Net looks down on the use of pointers and casting pointers to integers and vice versa, the good folks at CodeGear have chosen to hide the lParam and wParam message parameters from you, choosing instead to cast these values to more appropriate types which they then present to you in an object that is appropriate to the message that you received.  This is great if you want to act on the message yourself, but not so great if you want to pass the message on to some one else using SendMessage or PostMessage.  To do that you need the actual lParam and wParam values.

Fortunately, CodeGear also provides a means of accessing the old, Win32 style TMessage object belonging to the message that you just received.  Just use the OriginalMessage property and you can get access to the raw lParam and wParam values.

Leave a Reply