Jump to content

How to enable/disable a button inside a toolbar ?


claude21
 Share

Recommended Posts

Hi all,

I'm trying to re-enable a disabled (greyed) button on a toolbar from an external app. Autoit info says the class of the toolbar control is "msvb_lib_toolbar" but I can't see any references to the buttons themselves, nor I can't see any CommandID in the toolbar tab.

I've not found any information on controlling an external app toolbar buttons here, so if you have any information, I would be very grateful !

Thanks again

Link to comment
Share on other sites

Without knowing the commandID of the control (which was invisible for me), it's pretty hard to manipulate it. I found it myself this way (empirical way :D :

note : replace [CLASS:ThunderRT6MDIForm] and [CLASS:msvb_lib_toolbar] with your own

#Include <GuiToolBar.au3>

$title = WinGetTitle("[CLASS:ThunderRT6MDIForm]", "")

$hWnd = ControlGetHandle($title, "", "[CLASS:msvb_lib_toolbar]")

$result = ''
If isPtr($hWnd) then
    msgbox(0, '', "The handle is : " & $hWnd)
    For $i = 0 to 65536
        if _GUICtrlToolbar_EnableButton($hWnd, $i) then $result &= $i & ','
    next
Else
    msgbox(0, '', "This is not a valid pointer")
Endif

MsgBox(0, $title, "The following commandID are found to be valid for the control : " & $result )

then you can try to hide or disable each control to see which one is affected

Edited by claude21
Link to comment
Share on other sites

  • 5 weeks later...

I am trying to adapt your script but it fails.

$title = WinGetTitle("[CLASS:1234]", "") ; 1234 is the window class name
$hWnd = ControlGetHandle($title, "", "[CLASS:xxxx; INSTANCE:4]")  ;  CLASS:xxxx; INSTANCE:4 is the advanced class for this button
If $hWnd = "" Then MsgBox(0,"","error") ; for debug purpose
_GUICtrlButton_Enable($hWnd, False)
Sleep(10000)  ; to give time to check if the button is really disabled
Exit

The script itself doesn't fail but the button doesn't get disabled.

What am I doing wrong?

Edited by Akshay07
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...