I could not make the autohotkey code to work, but i found a C code that worked after some editing, I posted the source and binary here if someone need it https://github.com/m417z/taskbar-resize/issues/3
// no need to compile 64, compile only 32 version it works fine with win7 64
// i compile it with en_visual_studio_community_2013_with_update_5_x86_dvd_6816332.iso
#include <windows.h>
#include <shlwapi.h>
void main()
{
int argc;
WCHAR **argv = CommandLineToArgvW(GetCommandLine(), &argc);
if(argv)
{
if(argc >= 3)
{
BOOL bBottom = lstrcmpi(argv[1], L"-b") == 0;
BOOL bTop = lstrcmpi(argv[1], L"-t") == 0;
BOOL bRight = lstrcmpi(argv[1], L"-r") == 0;
BOOL bLeft = lstrcmpi(argv[1], L"-l") == 0;
int nMySize = StrToInt(argv[2]);
HWND hTaskbarWnd = FindWindow(L"Shell_TrayWnd", NULL);
if(hTaskbarWnd)
{
RECT rc;
GetWindowRect(hTaskbarWnd, &rc);
if(bBottom) {
rc.top = rc.bottom - nMySize;
SendMessage(hTaskbarWnd, WM_SIZING, WMSZ_TOP, (LPARAM)&rc);
SetWindowPos(hTaskbarWnd, NULL, 0, 0, rc.right - rc.left, nMySize, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
else if(bTop) {
rc.bottom = rc.top + nMySize;
SendMessage(hTaskbarWnd, WM_SIZING, WMSZ_BOTTOM, (LPARAM)&rc);
SetWindowPos(hTaskbarWnd, NULL, 0, 0, rc.right - rc.left, nMySize, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
else if(bRight) {
rc.left = rc.right - nMySize;
SendMessage(hTaskbarWnd, WM_SIZING, WMSZ_LEFT, (LPARAM)&rc);
SetWindowPos(hTaskbarWnd, NULL, 0, 0, nMySize, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
else if(bLeft) {
rc.right = rc.left + nMySize;
SendMessage(hTaskbarWnd, WM_SIZING, WMSZ_LEFT, (LPARAM)&rc);
SetWindowPos(hTaskbarWnd, NULL, 0, 0, nMySize, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
}
}
LocalFree(argv);
}
ExitProcess(0);
}
Usage
taskbar_resize.exe (-l|-r|-b|-t) new_size
Description:
-l - The taskbar is on the left.
-r - The taskbar is on the right.
-b - The taskbar is on the bottom.
-t - The taskbar is on the top.
new_size - The new size of the taskbar, in pixels.
NB: for top and bottom positions, you cannot resize to 3 rows from 1 row you have to resize to 2 rows first then resize to 3 rows
the following numbers are based on the taskbar with small icons not the big ones
taskbar_resize.exe -b 60 ===> 1 row
taskbar_resize.exe -b 70 ===> 2 rows
taskbar_resize.exe -b 110 ===> 3 rows
taskbar_resize.exe -b 150 ===> 4 rows
taskbar_resize.exe -b 180 ===> 5 rows
taskbar_resize.exe -b 220 ===> 6 rows
taskbar_resize.exe -b 250 ===> 7 rows
update:
I uploaded a compiled version for xp+ if someone need it, here: https://github.com/badrelmers/taskbar-resize/releases/tag/v1