How to change the order of buttons on the taskbar?

There are several free tools (for example, Taskbar Shuffle, XNeat, etc.) that have the ability to reorder buttons on the taskbar without actually closing or opening windows. Unfortunately, none of them are open source.

What are the API calls needed to rearrange the buttons on the taskbar?

+7
windows winapi button taskbar
source share
2 answers

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

The first parameter, SendMessage() ( hWndControl ), should be a link to a toolbar containing taskbar buttons. This is not trivial to retrieve, but the CodeProject entry mentioned in Chris Clark's answer has all the code needed to retrieve this descriptor.

wParam and lParam you need to set the button identifier of the button to move and the position to move it, respectively. These identifiers represent the idCommand field in the TBBUTTON structure, which represents each button; how to get these structures for buttons can also be taken from the CodeProject entry above.

+6
source share

The fact that the Windows API does not provide methods for reordering taskbar buttons is intentional. This is not supported.

See this article (and those to which it refers) for a discussion of why shell developers do not disclose this functionality.

However, resourceful people developed hacks to accomplish this (see other answers). I suspect that these methods will fall apart as Windows evolves (Windows 7, 64bit, etc.). Do not be surprised when these methods stop working.

+1
source share

All Articles