In Windows 10, you can choose between small or big icons for the taskbar. The setting is available through the UI by right clicking on the taskbar and going to the Settings:
It is also possible to adjust this setting through the registry editor (regedit.exe) by modifying the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarSmallIcons
The value is 0 for big icons and 1 for small icons. But as opposed to the UI setting, with this method you need to log out and log in your Windows user for the taskbar to be updated (restarting explorer.exe process also works but that's not an option).
I would like to be able to update the taskbar and choose between small or big icons programmatically. Is there any API for this, or any way to update the taskbar so that it read from the registry without having to log off? My specific aim is to automatically show small icons when I'm using a small screen (the one on the laptop) and big icons when I'm using a big screen (my regular big working screen).
Edit: Now Adaptive Taskbar for Windows is a reality thanks to the provided solutions :D
Before Windows 10 you could send the WM_SETTINGCHANGE
message to the taskbar but it seems like that no longer works. You might have to debug Explorer.exe to figure out how it is notified now.
Edit:
I just tested this with a simple C++ app and if you set a special LPARAM string it also works on Windows 10:
SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, (LPARAM)L"TraySettings", SMTO_NOTIMEOUTIFNOTHUNG, 3000, NULL);