Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetObject from ParentWindow property...

Status
Not open for further replies.

rcloutie

Programmer
May 26, 2005
164
CA
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
 
You may find this link helpful:

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top