From: xytsrm on
Hi Mike,

Thanks for the reply.

When the FindWindowEx frunction kept returning the wrong handle [presumably
it returned the handle of a Button that was on the form], I tried putting the
name of the textbox (ie. "myTextBox") in the fourth parameter. Then the
FindWindowEx returned a zero.

As I mentioned in a past post the FindWindowsEx only seems to return
something when I set the third and fourth parameters to vbNullString.

I was finely able to get the correct handle when I removed the Button
widget, and issued: FindWindowEx(Hndl, 0, vbNullString, vbNullString).

I thought passing the name of the textbox in the fourth parameter should
have worked, and I still don't understand why it hasn't.

Do you have any other thoughts or suggestions?

X.


"Mike Williams" wrote:

> "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
>
>
>
>
From: Nobody on
"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?

Forgot about FindWindow/FindWindowEx unless the controls have fixed text and
class names. Search the newsgroups for FindWindowLike() for alternatives.
Also, do not guess class names. You have to use Spy++(Part of Visual
Studio), or the following free alternative:

http://www.windows-spy.com/

You can also use this VB6 sample:

http://vbnet.mvps.org/code/enums/enumwindowsdemo.htm


From: xytsrm on
Thanks Nobody,

I've seen the ennumerate approach, I was hoping form something simpler. And
as I stated I can get the FindWindow/FindWindowEx to work; it's just
unfortunate that it doen't work as described.

However, I have downloaded Winspector, I read the features, I just hope
there's some instructions as to how to use it. From the description it
appears to be a stand-alone app.


X.

"Nobody" wrote:

> "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?
>
> Forgot about FindWindow/FindWindowEx unless the controls have fixed text and
> class names. Search the newsgroups for FindWindowLike() for alternatives.
> Also, do not guess class names. You have to use Spy++(Part of Visual
> Studio), or the following free alternative:
>
> http://www.windows-spy.com/
>
> You can also use this VB6 sample:
>
> http://vbnet.mvps.org/code/enums/enumwindowsdemo.htm
>
>
>
From: Nobody on
"xytsrm" <xytsrm(a)discussions.microsoft.com> wrote in message
news:30BCE444-9DF2-4625-AE86-81939CAF9BD7(a)microsoft.com...
> Thanks Nobody,
>
> I've seen the ennumerate approach, I was hoping form something simpler.
> And
> as I stated I can get the FindWindow/FindWindowEx to work; it's just
> unfortunate that it doen't work as described.

If you are looking for control names, such as Text1, you won't find them
because they are not exposed. And the class name is not documented, so you
have to use Spy++/GetClassName to see it.


From: xytsrm on
Ok, I'll check it with Winspector.

"Nobody" wrote:

> "xytsrm" <xytsrm(a)discussions.microsoft.com> wrote in message
> news:30BCE444-9DF2-4625-AE86-81939CAF9BD7(a)microsoft.com...
> > Thanks Nobody,
> >
> > I've seen the ennumerate approach, I was hoping form something simpler.
> > And
> > as I stated I can get the FindWindow/FindWindowEx to work; it's just
> > unfortunate that it doen't work as described.
>
> If you are looking for control names, such as Text1, you won't find them
> because they are not exposed. And the class name is not documented, so you
> have to use Spy++/GetClassName to see it.
>
>
>
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7
Prev: Centralised MsgBox
Next: Updating the VB EXE