To sum up the other thread: I was trying to automate a program using FindWindow and SendMessage. All is working just fine till I got to my next problem:
When I'm starting this application: AVI ReComp I only see 2 out of 5 tabs I'm supposed to see using the spy++ tool but when I actually look at the program I see all 5 tabs.
Wait it gets even weirder...
When I click on the tab that's not been showing in spy++, when I refresh the windows in spy++ tool it suddenly appears with all its controls.
Also, the same thing happens when I'm trying to get the handle for that same tab.
If I put a breakpoint after the program is loaded but before the handle is created and click on the tab before I continue, the handle works fine and gets all the correct values.
BUT, if I don't the handle is empty.
The issue contained 2 problems:
1. Each tab was created only when a click event occurred on it.
2. There was no way to switch between the tabs using the regular methods of TCM_SETCURSEL and such.
The answer to both questions is to generate a click event for each tab you want to use during the program. The click must happen from the tab container (The empty window which has the sys32tabcontrol class) and you must supply the right control coordinates (this can be retrieved from spy++ WM_LBUTTONUP/WM_LBUTTONDOWN events). Finally, use the MakeLParam function to combine the x and y coordinates of the click and insert them as parameters to SendMessage function.