Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the order of buttons on the taskbar?

There are a few freeware tools out there (e.g., Taskbar Shuffle, XNeat, etc.) which have the ability to change the order of the buttons on the taskbar, without actually closing or opening any windows. Unfortunately, none of them appears to be open-source.

What are the API calls required to change the order of buttons in the taskbar?

like image 966
Timwi Avatar asked Apr 28 '09 13:04

Timwi


1 Answers

The answer is to use TB_MOVEBUTTON in a call to SendMessage(), as described in the WinAPI documentation here.

The first parameter to SendMessage() (hWndControl) needs to be a reference to the toolbar that contains the taskbar buttons. This is non-trivial to retrieve, but the CodeProject entry referred to in Chris Clarke's answer has all the code required to retrieve this handle.

wParam and lParam need to be set to the button ID of the button to move, and the position to move it to, respectively. These IDs are the idCommand field in the TBBUTTON structure that represents each button; how to retrieve these structures for the buttons can also be taken from the above CodeProject entry.

like image 88
Timwi Avatar answered Sep 20 '22 04:09

Timwi