From: xytsrm on
I have a form with three visable items: a textbox, a label, and a button.
I'm simply trying to retrieve the handle of the textbox. I've used
FindWindow to retrieve the handle of the form, and have been using
FindWindowsEx to try and retrieve the handle of the Textbox. This works if
the textbox is the only entity on the form, but fails when there are other
items on the form. The only way I have been able to get FindWindowEx to
return anything is with the following format:

FindWindowEx (hndl, vbNullString, vbNullString).

According to "Appleman" I should be able to enter the title of the item in
the third parameter (eg. "myTextBox"), but that only returns 0, I've tried
entering "TextBox" for the class in the second parameter, but again that
returns 0.

This seems like it should be easy BUT? Does anyone have any suggestions?

X.

From: Rick Rothstein on
I may be missing something in your question, but why doesn't the hWnd
property to the TextBox give you what you want?

TextBoxHandle = myTextBox.hWnd

--
Rick (MVP - Excel)


"xytsrm" <xytsrm(a)discussions.microsoft.com> wrote in message
news:5B61CEBD-DEE4-446B-9127-EFCFE0CD6C0F(a)microsoft.com...
>I have a form with three visable items: a textbox, a label, and a button.
> I'm simply trying to retrieve the handle of the textbox. I've used
> FindWindow to retrieve the handle of the form, and have been using
> FindWindowsEx to try and retrieve the handle of the Textbox. This works
> if
> the textbox is the only entity on the form, but fails when there are other
> items on the form. The only way I have been able to get FindWindowEx to
> return anything is with the following format:
>
> FindWindowEx (hndl, vbNullString, vbNullString).
>
> According to "Appleman" I should be able to enter the title of the item in
> the third parameter (eg. "myTextBox"), but that only returns 0, I've tried
> entering "TextBox" for the class in the second parameter, but again that
> returns 0.
>
> This seems like it should be easy BUT? Does anyone have any suggestions?
>
> X.
>

From: Eduardo on
Rick Rothstein escribió:
>
> I may be missing something in your question, but why doesn't the hWnd
> property to the TextBox give you what you want?
>
> TextBoxHandle = myTextBox.hWnd
>

Yeah, but it's too easy...
From: xytsrm on
Sorry I guess I wasn't as clear as I could be; the "FindWindow" &
"FindWindowEx" functions are being issued from another App.

I have been able to get the correct handles by eliminating the button, and
although there is another widget with a handle property the textbox is being
seen first.

While I don't really need the button [I was only using it as an Exit, I can
use the Unload event just as well] I would still like to know if there is a
way to always get the handle of a specific widget using the FindWindowEx
function. The description of the function suggests that it's should be
possible by passing either the Name of the widget in the fourth parameter, or
at least the class name in the third parameter.


X.



"Rick Rothstein" wrote:

> I may be missing something in your question, but why doesn't the hWnd
> property to the TextBox give you what you want?
>
> TextBoxHandle = myTextBox.hWnd
>
> --
> Rick (MVP - Excel)
>
>
> "xytsrm" <xytsrm(a)discussions.microsoft.com> wrote in message
> news:5B61CEBD-DEE4-446B-9127-EFCFE0CD6C0F(a)microsoft.com...
> >I have a form with three visable items: a textbox, a label, and a button.
> > I'm simply trying to retrieve the handle of the textbox. I've used
> > FindWindow to retrieve the handle of the form, and have been using
> > FindWindowsEx to try and retrieve the handle of the Textbox. This works
> > if
> > the textbox is the only entity on the form, but fails when there are other
> > items on the form. The only way I have been able to get FindWindowEx to
> > return anything is with the following format:
> >
> > FindWindowEx (hndl, vbNullString, vbNullString).
> >
> > According to "Appleman" I should be able to enter the title of the item in
> > the third parameter (eg. "myTextBox"), but that only returns 0, I've tried
> > entering "TextBox" for the class in the second parameter, but again that
> > returns 0.
> >
> > This seems like it should be easy BUT? Does anyone have any suggestions?
> >
> > X.
> >
>
>
From: Mike Williams on
"xytsrm" <xytsrm(a)discussions.microsoft.com> wrote in message
news:59C39CFC-E2C8-48D0-88D3-99513C890D4A(a)microsoft.com...

> Sorry I guess I wasn't as clear as I could be; the "FindWindow"
> & "FindWindowEx" functions are being issued from another
> App [some stuff snipped] I would still like to know if there is
> a way to always get the handle of a specific widget using the
> FindWindowEx function.

If it is a VB6 Form and if you want a specific textbox (and if you know it's
name) then you can pass the name in the fourth parameter (for example,
"TextBox1"). If you just want the first TextBox it finds then you can pass
the class name in the third parameter ("ThunderTextBox") and a null string
in the fourth. Ideally I suppose you would pass both the class name and the
desired textbox name.

Mike



 |  Next  |  Last
Pages: 1 2 3 4 5 6 7
Prev: Centralised MsgBox
Next: Updating the VB EXE