Click here to Skip to main content
15,888,212 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi all

I am working on a project that requires getting trough tabs in a different application. I am using win32 api in order to access the handles in the other app. I managed to get my code to work, however it has a glitch. it turns out that when you use FindWindowEx() on the tab, it returns the first tab handle only. The way I got it to work is that I actually click the second tab only once end then the project runs flawless.

I used the Spy++ and when I looked at the 1st tab for the first time it shows no siblings(even though I have two more tabs), however when I click on the siblings and go back to the first tab and check again with spy++ it shows me the siblings. Therefore I can't use GetWindow(GW_HWNDNEXT) because it doesn't know it has a sibling until I click on the tab.

I am really trying to avoid using enumchildWindows() since I have no idea how it works, I've been trying to understand but I can hardly find examples, or a good explanation how to use it.

thank you in anticipation.
Posted
Updated 26-Aug-11 11:00am
v2
Comments
Sergey Alexandrovich Kryukov 26-Aug-11 17:04pm    
Your considerations look correct. Probably handles cannot be accessed by handles as you would do with separate windows. Unfortunately.
I never tried myself though, but your method of research also looks correct.
--SA
Philippe Mori 26-Aug-11 18:23pm    
It might also be possible that the tabs are created on demand the first time a page is displayed. Such optimization can help improve initial display performance.
nanomass 26-Aug-11 20:21pm    
I think you are right on that, he spy++ doesn't find any next tab, before I click them, is there any way I can get to initialize those handles of those tabs right after initial display?

You can't avoid using enumChildWindow. The tab pages are (probably) child windows of the tab control.
 
Share this answer
 
Comments
nanomass 26-Aug-11 20:19pm    
The tabs are definitely children of the tabcontrol, however I think Philippe is right I think they are created on demand, because the spy++ only finds the handle of the first one If I haven't clicked on the other tabs, so I'm not sure if the EnumChildWindow() will actually find a child tab before I click on them. I will try using the EnumChildWindow, but that's my prediction.... I really hope the EnumChildWindow() works!! lol
found a way to get around the EnumChildWindows() which didn't work because the handles for tab 2,3,... aren't created until you click on them. There is a function called SendInput() which allows you to just send whatever you want where ever the cursor is placed, hopefully I should be placing an article on this, I actually learned a lot of Win32 these past few day, thank you guys for all your help!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900