1. Declare an overload function of SendMessage instead of trying to typecast the LParam. The example below shows how to send TWinControl as LParam.
function SendMessage(hWnd: THandle; Msg: Cardinal; wParam: THandle; var LParam: TWincontrol): THandle; stdcall; overload; external 'User32.dll';
2. Using Marshal
Marshal.StructureToPtr(Control, LParam, True);
SendMessage(Control.Handle, CM_MOUSELEAVE, 0, THandle(LParam));
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment