WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

EXAMPLES FROM USERS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Toolbar Button Status


In my endeavor to try and find a way to figure out what the state is of a Toolbar Button, I have come up with this. Note: this code works on Windows 2000 and newer.

AddExtender("wwctl34i.dll")

sText = ""
iButtonNum = "1015"

window1=cWndByWndSpec("ExploreWClass","explorer",6,40965,9999,40961,0,0,0)
window2=cWndByID(window1,40965)
window3=cWndByID(window2,40965)
ControlHandle=cWndByID(window3,40960)
iButtonStatus = IntControl(22, ControlHandle, 1042, iButtonNum, 0)

While iButtonStatus == 4
TimeDelay(2)
iButtonStatus = IntControl(22, ControlHandle, 1042, iButtonNum, 0)
EndWhile
Message("Button %iButtonNum% Status", iButtonStatus)
To test it, open up a Windows Explorer window. Browse to a sub-directory. You will notice in your tool bar the the "LEFT" arrow is available, but the "RIGHT" arrow is not. Click the "LEFT" arrow. You will now see that BOTH arrows are available.

The script just keeps looping every 2 seconds waiting for the "RIGHT" arrow to become disabled. When it is, it sends a message to you letting you know that it no longer is available.

The SendMessage command that is being sent (1042) is the TB_GETSTATE command. You can find info on it here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/toolbar/messages/tb_getstate.asp

There is also a link there that shows you what all the possible states of the Toolbar Buttons are.


Article ID:   W16336
File Created: 2005:02:18:12:19:52
Last Updated: 2005:02:18:12:19:52