SendMessage like in unit Forms not compiling

Giganews Newsgroups
Subject: SendMessage like in unit Forms not compiling
Posted by:  John Schmidt (j.schmi…@npkelektro.com)
Date: Tue, 12 Sep 2006

Hello,

I have discovered following in the unit Forms:

procedure TApplication.HookMainWindow(Hook: TWindowHook);
.........
      SendMessage(FHandle, CM_WINDOWHOOK, 0, Longint(@@Hook));

So I have done the same:

procedure TDsgnManager.ImageDblClick(Sender: TObject);
var
  Img: TDsgnImage;
begin
    Img := Sender as TDsgnImage;  // As parameter of type variable
required....
    SendMessage(Application.MainFormHandle, WM_IMAGEPATH, 0,
Longint(@@Img));
end;

Why does this compile in case of TApplication but in my case? If I use
directly Sender inspite of the variable assignement it doesn't work too (the
error message requires a variable type as parameter).

Thanks,
John

Replies