Hi there,
I'm trying to get the instance of a TWinControl which is set as a ParentWindow of a TForm. In other words, how to obtain a reference to a control by it's handle?
I tried the following but it doesn't work:
{ ----------------------------------------------------- }
var ctl: TWinControl;
begin
GetObject(frm.ParentWindow, SizeOf(TWinControl), @ctl);
if ctl <> nil then
if ctl is TMyControl then
{ previous line generates 'access violation...' }
end;
{ ----------------------------------------------------- }
Any ideas?
Thanks in advance,
RC
I'm trying to get the instance of a TWinControl which is set as a ParentWindow of a TForm. In other words, how to obtain a reference to a control by it's handle?
I tried the following but it doesn't work:
{ ----------------------------------------------------- }
var ctl: TWinControl;
begin
GetObject(frm.ParentWindow, SizeOf(TWinControl), @ctl);
if ctl <> nil then
if ctl is TMyControl then
{ previous line generates 'access violation...' }
end;
{ ----------------------------------------------------- }
Any ideas?
Thanks in advance,
RC