[DUG] parenting
Ross Levis
ross at stationplaylist.com
Mon Dec 11 21:40:03 NZDT 2006
I found it! The IsChild function does the trick. It works for all
decendants of children as well.
Regards,
Ross.
----- Original Message -----
From: "Ross Levis" <ross at stationplaylist.com>
To: "NZ Borland Developers Group - Delphi List" <delphi at ns3.123.co.nz>
Sent: Monday, December 11, 2006 9:30 PM
Subject: Re: [DUG] parenting
Ah, but that requires a TControl, not a handle. Some of the handles I
need to test will be from a DLL and not a Delphi application.
Currently I'm having to do a test like this.
hwnd := GetParent(Msg.hwnd);
If (hwnd = MainForm.Handle) or hwnd = GroupBox1.Handle) or (hwnd =
GroupBox2.Handle), etc, for all container controls.
It needs to be fast because the routine is involved in message handling,
so I can't afford to loop through all controls on a form to test their
handles to see if the message belongs to the form. I guess I could put
all the handles into an array when the application starts and loop the
array for each message. This should be fast enough, but just wondering
if the Windows API provided a better way.
Thanks,
Ross.
----- Original Message -----
From: "Rohit Gupta" <r.gupta at xtra.co.nz>
To: "NZ Borland Developers Group - Delphi List" <delphi at ns3.123.co.nz>
Sent: Monday, December 11, 2006 8:54 PM
Subject: Re: [DUG] parenting
You can use GetParentForm and then compare with the form you want.
Ross Levis wrote:
> Is there a Windows API call that can tell me if a handle
> is a child/grand child/great grandchild/etc of another handle. I
> don't need to know the specific relationship, just whether it is
> related.
>
> I basically just want to know if a given handle is a component on a
> form.
>
> Thanks,
> Ross.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi
More information about the Delphi
mailing list