468,720 Members | 1,646 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

FindWindowEx - panel issues I think

kru
Hi All,

I've been trying to get FindWindowEx to work to locate a button, and
am stumped on the following:

The structure of the external app is as so from Spy++:

- "Main Window" - ThunderRT6FrmDC
- "" - ThunderRT6Frame (outer panel)
- "" - ThunderRT6Frame (inner panel)
- "&Feedback" - ThunderRT6CommandButton (button within
2 panels)

This is my code so far:

Dim parentHnd as New IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd, IntPtr.Zero,
"ThunderRT6Frame", "")
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", "")
Dim feedbackBtnHnd = FindWindowEx(smlcontainerHnd, IntPtr.Zero,
"ThunderRT6CommandButton", "&Feedback")

I can get handle results for the parentHnd and also the first panel
bigcontainerHnd however get 0's for the smalcontainerHnd and the
feedbackBtnHnd, can anyone see what I'm doing wrong in the above code?

Many thanks,
Kru
Jan 7 '08 #1
6 3513
"kru" <kr*****@gmail.comschrieb
Hi All,

I've been trying to get FindWindowEx to work to locate a button, and
am stumped on the following:

The structure of the external app is as so from Spy++:

- "Main Window" - ThunderRT6FrmDC
- "" - ThunderRT6Frame (outer panel)
- "" - ThunderRT6Frame (inner panel)
- "&Feedback" - ThunderRT6CommandButton (button within
2 panels)

This is my code so far:

Dim parentHnd as New IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd, IntPtr.Zero,
"ThunderRT6Frame", "")
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", "")
Dim feedbackBtnHnd = FindWindowEx(smlcontainerHnd, IntPtr.Zero,
"ThunderRT6CommandButton", "&Feedback")
Not the real code, is it? Can't compile it. Nevertheless, after changing
it...
I can get handle results for the parentHnd and also the first panel
bigcontainerHnd however get 0's for the smalcontainerHnd and the
feedbackBtnHnd, can anyone see what I'm doing wrong in the above
code?
....it works here. I created a VB6 application using this control structure,
and I get 4 valid handles. Are you sure the Caption is really "" for the
frames? Maybe it's a blank?
Armin

Jan 7 '08 #2
On Jan 7, 5:44 am, kru <krus...@gmail.comwrote:
Hi All,

I've been trying to get FindWindowEx to work to locate a button, and
am stumped on the following:

The structure of the external app is as so from Spy++:

- "Main Window" - ThunderRT6FrmDC
- "" - ThunderRT6Frame (outer panel)
- "" - ThunderRT6Frame (inner panel)
- "&Feedback" - ThunderRT6CommandButton (button within
2 panels)

This is my code so far:

Dim parentHnd as New IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd, IntPtr.Zero,
"ThunderRT6Frame", "")
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", "")
Dim feedbackBtnHnd = FindWindowEx(smlcontainerHnd, IntPtr.Zero,
"ThunderRT6CommandButton", "&Feedback")

I can get handle results for the parentHnd and also the first panel
bigcontainerHnd however get 0's for the smalcontainerHnd and the
feedbackBtnHnd, can anyone see what I'm doing wrong in the above code?

Many thanks,
Kru
You may want to revise and take a look at pinvoke.net:

http://www.pinvoke.net/default.aspx/...dWindowEx.html
Jan 7 '08 #3
kru
On Jan 7, 8:40*pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"kru" <krus...@gmail.comschrieb
Hi All,
I've been trying to get FindWindowEx to work to locate a button, and
am stumped on the following:
The structure of the external app is as so from Spy++:
- "Main Window" - ThunderRT6FrmDC
* * - "" - ThunderRT6Frame * * * (outer panel)
* * * * *- "" - ThunderRT6Frame *(inner panel)
* * * * * * * - "&Feedback" - ThunderRT6CommandButton (button within
2 panels)
This is my code so far:
Dim parentHnd as New IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd, IntPtr.Zero,
"ThunderRT6Frame", "")
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", "")
Dim feedbackBtnHnd = FindWindowEx(smlcontainerHnd, IntPtr.Zero,
"ThunderRT6CommandButton", "&Feedback")

Not the real code, is it? Can't compile it. Nevertheless, after changing
it...
I can get handle results for the parentHnd and also the first panel
bigcontainerHnd however get 0's for the smalcontainerHnd and the
feedbackBtnHnd, can anyone see what I'm doing wrong in the above
code?

...it works here. I created a VB6 application using this control structure,
and I get 4 valid handles. Are you sure the Caption is really "" for the
frames? Maybe it's a blank?

Armin
Hi Armin thanks for the reply.

Yep that was a portion of the real code, following that code I just
used msgbox's to check for handles. This is part of a VB.NET
application I'm modifying.

Using the Spy++ tree structure it shows the captions as being "",
however I think it showed nothing when I used the target tool (not at
work currently). When I get in tomorrow I will give vbstringnull a try
though I'm not sure if it will make a difference but worth a shot.

Thanks again
Jan 7 '08 #4
kru
On Jan 7, 9:37*pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Jan 7, 5:44 am, kru <krus...@gmail.comwrote:
Hi All,
I've been trying to get FindWindowEx to work to locate a button, and
am stumped on the following:
The structure of the external app is as so from Spy++:
- "Main Window" - ThunderRT6FrmDC
* * *- "" - ThunderRT6Frame * * * (outer panel)
* * * * * - "" - ThunderRT6Frame *(inner panel)
* * * * * * * *- "&Feedback" - ThunderRT6CommandButton (button within
2 panels)
This is my code so far:
Dim parentHnd as New IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd, IntPtr.Zero,
"ThunderRT6Frame", "")
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", "")
Dim feedbackBtnHnd = FindWindowEx(smlcontainerHnd, IntPtr.Zero,
"ThunderRT6CommandButton", "&Feedback")
I can get handle results for the parentHnd and also the first panel
bigcontainerHnd however get 0's for the smalcontainerHnd and the
feedbackBtnHnd, can anyone see what I'm doing wrong in the above code?
Many thanks,
Kru

You may want to revise and take a look at pinvoke.net:

http://www.pinvoke.net/default.aspx/...dWindowEx.html
Thanks kimi, the only difference from the code at pinvoke and mine
appears to be the last argument IntPtr.Zero, I'll try IntPtr.Zero
instead when I get to work however I think I have tried that also.

Thanks for the response & best of luck this season!
Jan 7 '08 #5
kru
On Jan 7, 11:46*pm, kru <krus...@gmail.comwrote:
On Jan 7, 8:40*pm, "Armin Zingler" <az.nos...@freenet.dewrote:


"kru" <krus...@gmail.comschrieb
Hi All,
I've been trying to get FindWindowEx to work to locate a button, and
am stumped on the following:
The structure of the external app is as so from Spy++:
- "Main Window" - ThunderRT6FrmDC
* * - "" - ThunderRT6Frame * * * (outer panel)
* * * * *- "" - ThunderRT6Frame *(inner panel)
* * * * * * * - "&Feedback" - ThunderRT6CommandButton (button within
2 panels)
This is my code so far:
Dim parentHnd as New IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd, IntPtr.Zero,
"ThunderRT6Frame", "")
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", "")
Dim feedbackBtnHnd = FindWindowEx(smlcontainerHnd, IntPtr.Zero,
"ThunderRT6CommandButton", "&Feedback")
Not the real code, is it? Can't compile it. Nevertheless, after changing
it...
I can get handle results for the parentHnd and also the first panel
bigcontainerHnd however get 0's for the smalcontainerHnd and the
feedbackBtnHnd, can anyone see what I'm doing wrong in the above
code?
...it works here. I created a VB6 application using this control structure,
and I get 4 valid handles. Are you sure the Caption is really "" for the
frames? Maybe it's a blank?
Armin

Hi Armin thanks for the reply.

Yep that was a portion of the real code, following that code I just
used msgbox's to check for handles. This is part of a VB.NET
application I'm modifying.

Using the Spy++ tree structure it shows the captions as being "",
however I think it showed nothing when I used the target tool (not at
work currently). When I get in tomorrow I will give vbstringnull a try
though I'm not sure if it will make a difference but worth a shot.

Thanks again- Hide quoted text -

- Show quoted text -
I've tried using vbNullString in the 4th argument and it hasn't
worked. I think you are correct with the captions being blank however
I'm still getting no handle result for the second inner panel.

My declarations:

Private Declare Auto Function FindWindow Lib "user32" (ByVal
lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Auto Function FindWindowEx Lib "user32" (ByVal
hWnd1 As IntPtr, ByVal hWnd2 As IntPtr, ByVal lpsz1 As String, ByVal
lpsz2 As String) As IntPtr
This is my exact code placed within a button click:

Dim parentHnd As IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd,
IntPtr.Zero, "ThunderRT6Frame", vbNullString)
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", vbNullString)
Dim feedbackBtnHnd As IntPtr = FindWindowEx(smlcontainerHnd,
IntPtr.Zero, "ThunderRT6CommandButton", "&Feedback")

MsgBox(parentHnd) - returns a non 0
MsgBox(bigcontainerHnd) - returns a non 0
MsgBox(smlcontainerHnd) - returns 0
MsgBox(feedbackBtnHnd) - reutrns 0

If anyone else has any ideas on what I'm doing incorrectly let me know
please, thank you kindly.

- Kru
Jan 7 '08 #6
kru
On Jan 7, 11:53*pm, kru <krus...@gmail.comwrote:
On Jan 7, 9:37*pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:


On Jan 7, 5:44 am, kru <krus...@gmail.comwrote:
Hi All,
I've been trying to get FindWindowEx to work to locate a button, and
am stumped on the following:
The structure of the external app is as so from Spy++:
- "Main Window" - ThunderRT6FrmDC
* * *- "" - ThunderRT6Frame * * * (outer panel)
* * * * * - "" - ThunderRT6Frame *(inner panel)
* * * * * * * *- "&Feedback" - ThunderRT6CommandButton(button within
2 panels)
This is my code so far:
Dim parentHnd as New IntPtr = FindWindow("ThunderRT6FormDC", "Main
Window")
Dim bigcontainerHnd As IntPtr = FindWindowEx(parentHnd, IntPtr.Zero,
"ThunderRT6Frame", "")
Dim smlcontainerHnd As IntPtr = FindWindowEx(bigcontainerHnd,
IntPtr.Zero, "ThunderRT6Frame", "")
Dim feedbackBtnHnd = FindWindowEx(smlcontainerHnd, IntPtr.Zero,
"ThunderRT6CommandButton", "&Feedback")
I can get handle results for the parentHnd and also the first panel
bigcontainerHnd however get 0's for the smalcontainerHnd and the
feedbackBtnHnd, can anyone see what I'm doing wrong in the above code?
Many thanks,
Kru
You may want to revise and take a look at pinvoke.net:
http://www.pinvoke.net/default.aspx/...dWindowEx.html

Thanks kimi, the only difference from the code at pinvoke and mine
appears to be the last argument IntPtr.Zero, I'll try IntPtr.Zero
instead when I get to work however I think I have tried that also.

Thanks for the response & best of luck this season!- Hide quoted text -

- Show quoted text -
No luck with IntPtr.Zero either for the 4th argument for FindWindowEx
hmm
Jan 7 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by TR | last post: by
7 posts views Thread by Lars Netzel | last post: by
12 posts views Thread by Peter | last post: by
4 posts views Thread by =?Utf-8?B?Rmx5Z3V5?= | last post: by
2 posts views Thread by =?Utf-8?B?TUNN?= | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.