Click here to Skip to main content
13,249,087 members (38,888 online)
Rate this:
 
Please Sign up or sign in to 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 26-Aug-11 11:59am
Updated 26-Aug-11 12:00pm
v2
Comments
SAKryukov 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?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You can't avoid using enumChildWindow. The tab pages are (probably) child windows of the tab control.
  Permalink  
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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!
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.171114.1 | Last Updated 28 Aug 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100