No announcement yet.

VB6: Get ContorlID of a Button in an External Application

  • Filter
  • Time
  • Show
Clear All
new posts

  • VB6: Get ContorlID of a Button in an External Application

    I'm in the process of rewriting my plugin from AutoIt to VB6 so it's better compatible with the RoadRunner Front End.

    Here's my issue:

    In AutoIt there's a function called:
    ControlGetHandle - "Retrieves the internal handle of a control."

    This means that I can get the handle of any window and of any control in that window (such as a button).
    That way I could send a Click Message to that button using the SendMessage command.

    $WAhandle = ControlGetHandle("classname=Winamp v1.x", "", 0) ;Gets the Winamp Handle
    $JFhandle = ControlGetHandle("Jump to file", "", 0)          ;Gets the JTFP Handle
    $JTFBhandle = ControlGetHandle($JFhandle, "", 4918)          ;Gets the Jump to File Button Handle
    With the code above, JTFBhandle is the direct handle to the Jump button on the "Jump-to-File" Window.


    Visual Explanation:
    (It is essential that I am being correctly understood.)

    In Visual Basic 6.0, I can get to the "Jump-to-File's" Window handle, but I can't access the handles of the buttons that are on the window itself.

    Click image for larger version

Name:	Jump_Window.JPG
Views:	1
Size:	19.1 KB
ID:	2300718
    See the buttons Enqueue File, Move after current, Jump to file, etc.?
    Their Control ID's are 4919, 4920, and 4918 respectively.

    I need to get to the handles of these buttons based on their Control ID numbers above.
    How do I do it in Visual Basic 6.0?
    For Sale: Carputer (CarPC) & RCA Y-Adapter
    Newsflash: Take a look at my unsold stuff above, thanks!
    Up Next: Make an OBD to Serial cable & Redo the "MMI buttons"

  • #2
    Look at GetDlgItem API help.


    • #3
      yea thats what i used for IGQ there was alot of extra stuff going on as well tho

      if (getdlgitem(blah) = true AND getparent("winamp") = true) 
      then match=1
      syntax is probably off but getdlgitem is not as powerful as autoits getcontrolid
      so you need to make a similar function to check for the same things otherwise it find all sorts of weird windows and controls
      | '_ |__\___
      [(o)|___(o)] XB
      | I__I I_I|_\__I
      [(o)______(o)]b VanPimpin'

      LostReceptions Apps D/L Here

      GPSGasoline- Rewriting

      Draw- SkribblePad for Touchscreens

      iGQwerty-iG3.0 Qwerty Keyboard