473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 3787
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: TR | last post by:
Hi All: I have a simple test GUI that has 2 panels (a left side and a right side), and each panel is displaying an image. The left panel has a hardcoded size of (600,400) using the Dimension()...
1
by: enahar | last post by:
Hello, i want to find out how many instances of a form (say childForm1) is running using FindWindowEx but value return is always zero by this method. What wrong I am doing it..Can anybody...
4
by: Simon Matthews | last post by:
Hi, I'm trying to find a window handle using FindWindowEx. I get an error undecalred identifier if I use FindWindowEx() and not a member of global namespace if I use ::FindWindowEx()... Even...
7
by: Lars Netzel | last post by:
Do I use FindWindowEx() to find control ( a button.. ) within a Window or is that only to find child Windows after using FindWindows() best regards /Lars
12
by: Peter | last post by:
Using .NET 1.1 Window Forms I would like to place over 400 pictures on a panel control one after another one so user can scroll through them, but each picture is up to 200 pixels in height...
4
by: =?Utf-8?B?Rmx5Z3V5?= | last post by:
How can I update the html inside of a panel? How can I make this code work <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
3
by: Doc John | last post by:
I have a windows Form that inherits from Base_form. In Base_form I added a panel that covers the whole Form (panel1.Dock = Fill). The problem is that all the controls in the Form that inherit...
1
by: Trompomerson | last post by:
Hello, I am running the code below in an Excell '03 userform, the purpose of the code is to set the form as a child of the workbook so it moves around with it etc. however the last call to the...
2
by: =?Utf-8?B?TUNN?= | last post by:
I have an asp.net page that contains an update panel. Within the update panel, controls get added dynamically. During partial page post backs the controls within the panel will change. I have a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.