Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: EnumChildWindows for Labels

146 views
Skip to first unread message

Liz

unread,
Apr 12, 2005, 1:46:23 PM4/12/05
to
Jack wrote:

> How can I read the caption of label contained in a different
> application thru the applications handle. I'm using GetWindowText and
> GetClassName to get the windows handle of the applications main or
> child form, but EnumChildWindows doesn't enum the TLabels contained
> on the form.

If the app isnt a delphi app, or a borland derivitive, it wont be
TLabel, if you have a look with microsoft spy program it can show you
often however, I think you cant easily tell.

Joseph Donnelly

unread,
Apr 12, 2005, 2:06:31 PM4/12/05
to
Jack wrote:

> How can I read the caption of label contained in a different
> application thru the applications handle. I'm using GetWindowText and
> GetClassName to get the windows handle of the applications main or
> child form, but EnumChildWindows doesn't enum the TLabels contained
> on the form.

In addition to what Liz said, if the other application is made with
Delphi or CPPB, you won't be able to find TLabels using
EnumChildWindows because they are descended from TGraphicControl and
don't have window handles (unlike the progeny of TWinControl).

--
Joe

Jack

unread,
Apr 12, 2005, 12:42:29 PM4/12/05
to
Hi,

How can I read the caption of label contained in a different application
thru the applications handle. I'm using GetWindowText and GetClassName to
get the windows handle of the applications main or child form, but
EnumChildWindows doesn't enum the TLabels contained on the form.

Thanks in advance.

-Jack


Jack

unread,
Apr 12, 2005, 1:23:25 PM4/12/05
to
Hi,

The other app is a Delphi app, and yes TLabel's do have window handles. So
the question is: Is there any way to get the label caption contained on a
given windows handle.

Thanks

-Jack


"Joseph Donnelly" <j_j_do...@yahoo.com> wrote in message
news:xn0e0wsl...@forums.borland.com...

Andrew Ryazanov

unread,
Apr 12, 2005, 1:25:26 PM4/12/05
to
"Jack" <nos...@nospam.com> wrote in message
news:425c03ab$1...@newsgroups.borland.com...

> The other app is a Delphi app, and yes TLabel's do have window handles. So
> the question is: Is there any way to get the label caption contained on a
> given windows handle.

Yes, simply send the WM_GETTEXT message.


Joseph Donnelly

unread,
Apr 12, 2005, 2:46:41 PM4/12/05
to
Jack wrote:

> The other app is a Delphi app, and yes TLabel's do have window
> handles. So the question is: Is there any way to get the label
> caption contained on a given windows handle.

Jack,

I beg to differ, at least through D6. There is no handle property
(which is the window handle) in a TLabel. As mentioned before, they are
descended from the TGraphicControl branch rather than the TWinControl
branch off of TControl. As there is no Window handle for the TLabel,
EnumChildWindows will not retrieve the non-existant handle label.

Perhaps the other Delphi application needs to use a TStaticText (which
does have a window handle)?

--
Joe

Jack

unread,
Apr 12, 2005, 3:50:48 PM4/12/05
to
Andrew,

Andrew,

What WindowHandle do I pass to SendMessage to accomplish this.

Thanks

-Jack

"Andrew Ryazanov" <au...@rin.ru> wrote in message
news:425c...@newsgroups.borland.com...

Jack

unread,
Apr 12, 2005, 3:53:00 PM4/12/05
to

"Joseph Donnelly" <j_j_do...@yahoo.com> wrote in message
news:xn0e0wtl...@forums.borland.com...

> Perhaps the other Delphi application needs to use a TStaticText (which
> does have a window handle)?
>
> --
> Joe

Joe,

This would be of great help if I have control over the development of the
other program. As it is the other program is not developed by us, we are
just trying to get the current information displayed so we could develop a
so called add-on.

Thanks

-Jack


Andrew Ryazanov

unread,
Apr 12, 2005, 4:44:15 PM4/12/05
to
"Jack" <nos...@nospam.com> wrote in message
news:425c...@newsgroups.borland.com...

> What WindowHandle do I pass to SendMessage to accomplish this.

The handle of the child control you need. I supposed you enum them using
EnumChildWindows and have their handles.


paul mayer

unread,
Apr 26, 2005, 9:21:05 AM4/26/05
to
0 new messages