Jump to content

Getting the $iCommandID of a button


Recommended Posts

Hi,

I want to use the _GUICtrlToolbar_ UDF functions but they mostly rely on knowing the handle for the control and the button's $iCommandID Button command ID .

Problem is, I can't seem to find out how to get the button command ID that I want to press.

How do I get that info? The Window Info tool only gives me info on the Control and not the specific Button.

Thanks,

Jeff

Link to comment
Share on other sites

_GUICtrlToolbar_AddButton($hWnd, $iID, $iImage[, $iString = 0[, $iStyle = 0[, $iState = 4[, $iParam = 0]]]])

The second para is the controlID. Or do I misunderstand the question? Then provide a sample please.

Edited by KaFu
Link to comment
Share on other sites

Hey Kafu, and others,

I'm talking about functions like "_GUICtrlToolbar_PressButton"

_GUICtrlToolbar_PressButton($hWnd, $iCommandID[, $fPress = True])

It has the following parameters:

Parameters

$hWnd Handle to the control

$iCommandID Button command ID

$fPress Pressed state:

True - Button will be set to a pressed state

False - Button will be set to an unpressed state

What I want to do is ensure that a specific button is pressed down (toggled so that it is pressed in).

The only problem is that I think that the $iCommandID variable is to identify the specific button in a ToolbarWindow32 control... but I don't know how to get the info on the button in question. How do I know what the $iCommandID is for the button I want to press?

Thanks,

Jeff

Link to comment
Share on other sites

That's as far as I get at the moment, example is an open windows explorer. Might be a start.

#include <GuiToolbar.au3>
#include <array.au3>

$hWnd = ControlGetHandle("[CLASS:ExploreWClass]", "", "ToolbarWindow323")

MsgBox(0,'',  'hWnd: ' & $hWnd & @crlf _
            & 'ButtonCount: ' & _GUICtrlToolbar_ButtonCount($hWnd))
            
dim $hWnd_button_text[_GUICtrlToolbar_ButtonCount($hWnd)][3]
for $i = 0 to _GUICtrlToolbar_ButtonCount($hWnd) - 1
    $hWnd_button_text[$i][0] = $i
    $hWnd_button_text[$i][1] = _GUICtrlToolbar_GetButtonText($hWnd, _GUICtrlToolbar_IndexToCommand($hWnd, $i))
    $hWnd_button_text[$i][2] = _GUICtrlToolbar_IndexToCommand($hWnd, $i)
Next

_ArrayDisplay($hWnd_button_text)
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...