Results 1 to 3 of 3

Thread: Problems aquring handle of a trackbar

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Location
    Essex, UK
    Posts
    149

    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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Location
    Essex, UK
    Posts
    149

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width