Results 1 to 5 of 5

Thread: [RESOLVED] Object Picker like Spy++???

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2001
    Location
    Toronto, Ontario, Canada
    Posts
    56

    Object Picker like Spy++???

    I know there is an API call "WindowFromPoint" that returns the handle of a WINDOW based on coordinates.

    (see sample here: http://www.mvps.org/vb/code/WndPick.zip

    But does anyone know of an API call that allows you to identify objects (such as a form, frame, radio button, and windows)?

    I've seen this done with software like "PowerPad", "Rational Visual Test", "Snag It"... can this be done in VB?

  2. #2
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    Once you have the window handle you can get all this additional information using the windows API. There are a number of calls, all of which are wrapped up in this ApiWindow class.

    To use it:
    VB Code:
    1. Dim wndTest As New ApiWindow
    2.  
    3. wndTest.hwnd = WindowFromPoint(ptThis)
    4.  
    5. Debug.print wndTest.WNDCLASS.lpszClassname 'eg. ThunderList is a VB listbox etc...
    6. Debug.Print wndTest.WindowText 'if its a textbox this is the text , etc...

    There are a whole raft of other properties - which you would like to know about?

    HTH,
    Duncan
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Bishop, GetClassName API could be used to find out the class name of each window/object.

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2001
    Location
    Toronto, Ontario, Canada
    Posts
    56
    Thanks for the feedback guys.. but you're actually two steps in my project ahead of me... ^_^

    Now I know I can use what you have recommended to get the rest of the information I need...

    But what if I want to get the handle of a button, or frame, or text field instead of the window? Is there anyway to point at a control and ask it to give me the handle for that instead?

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2001
    Location
    Toronto, Ontario, Canada
    Posts
    56

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