Problems aquring handle of a trackbar
I am trying to aquire the handle of a trackbar contained in a 3rd party program. This is proving quite hard to identify due to the following:
- There are multiple trackbars using the same classname (3 of them)
- The trackbar doesnt have a title name
- The trackbars ID number is the same as its handle so changes every time its run so its not static
As the trackbar has NO unique features how can i aquire its handle dynamically on runtime using my program. I cannot use "EnumChildWindows" or "FindWindowEx" API's as their are no unique features to allow me to identify the correct trackbar from the 3 that are available.
Any suggestions ? i always thought the ID number was supposed to be static on an application.
Re: Problems aquring handle of a trackbar
There are always unique features. If there are three track bars then they will always be in the same order on the form. You can call FindowWindowEx more than once and specify a child window to start searching after. That way you can get all three track bar handles in the same order every time. You can use WinID to identify the handle for each track bar and then use Spy++ to determine which order the three are in. Then you'll know how many times to call FindWindowEx.
Re: Problems aquring handle of a trackbar
Thanks for the assistance jmcilhinney.
I managed to find an alternative way to identify the trackbar im intrested in. I enumerated throught the windows / objects and then scanned them for width / height size. If the object matched the width / height of the trackbar i then knew that object was the one i required and then stored its handle for later use. This method however would have some faults for eg if trackbars resized or 2x trackbars use the same dimensions. But if you use it combined with comaprison of ID/title/classname its pretty accurate. However this method works and uses minimal code and loops which is what i like.
Also recommend WINSPECTOR, much better than SPY++ . Easier to use and much more powerfull