Jump to content

Get width of my application's taskbar button.


Recommended Posts

Hi,

I would like to know how to get the width of my application's taskbar button. Had a look at GetSystemMetrics but couldn't find anything interesting...

Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

Hi,

I would like to know how to get the width of my application's taskbar button. Had a look at GetSystemMetrics but couldn't find anything interesting...

The taskbar is just a toolbar, and those are just buttons on the toolbar. Use _GuiCtrlToolBar_GetButtonSize() on it.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I'm confused on how to use that function...is it something like

_GuiCtrlToolBar_GetButtonSize('[CLASS:Shell_TrayWnd]')

?

And if so, wouldn't that get it for all taskbar buttons, even though each can vary in size on Windows 7(think pinned items)?

Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

In XP, they are all the same size. I can't pry my son off Left4Dead long enough to try anything on the Win7 box.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

In XP, they are all the same size. I can't pry my son off Left4Dead long enough to try anything on the Win7 box.

:)

Lol B)

Also this code:

Global $TaskbarButtonSize = _GuiCtrlToolBar_GetButtonSize('[CLASS:Shell_TrayWnd]')
MsgBox(-1, 'Return Value', $TaskbarButtonSize)

Gives a blank MsgBox ;)

Edited by Vadersapien
Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

Also this code:

Global $TaskbarButtonSize = _GuiCtrlToolBar_GetButtonSize('[CLASS:Shell_TrayWnd]')
MsgBox(-1, 'Return Value', $TaskbarButtonSize)

Gives a blank MsgBox :)

Review that function in the help file. You didn't pass the handle to the toolbar control. You didn't even pass the class for the control, that's the window. Also, it returns an array.

This works on XP, don't know what it does on Win7:

#include <GuiToolbar.au3>

Global $hWin = WinGetHandle("[CLASS:Shell_TrayWnd; INSTANCE:1]", "")
Global $hTaskbar = ControlGetHandle($hWin, "", "[CLASS:ToolbarWindow32; INSTANCE:2]")
Global $TaskbarButtonSize = _GUICtrlToolbar_GetButtonSize($hTaskbar)
MsgBox(64, 'Return Value', "$TaskbarButtonSize[0] (Height) = " & $TaskbarButtonSize[0] & @CRLF & _
        "$TaskbarButtonSize[1] (Width) = " & $TaskbarButtonSize[1])

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

That code gives me "Height:38 Width:24", even though they're wider then they are higher(maybe it's just mixed up). Anyway even the width is far off 38 pixels.

Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

  • Moderators

Vadersapien,

Use the Au3Info tool to determine the correct title to use for the taskbar. For example, on my Vista system:

[CLASS:ToolbarWindow32; INSTANCE:2] = the notification area - I get 18x18

[CLASS:ToolbarWindow32; INSTANCE:4] = the main taskbar - I get 164 x 30

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...