Here's an example for Internet Explorer 11 (called from dll injected into iexplore):
HWND Suchleiste = FindWindowEx(GetActiveWindow(), NULL, NULL, "Navigationsleiste"); // WorkerW
Suchleiste = FindWindowEx(Suchleiste, NULL, "ReBarWindow32", NULL);
AddressbarRight = FindWindowEx(Suchleiste, NULL, "ControlBandClass", NULL);
AddressbarRight = FindWindowEx(AddressbarRight, NULL, "ToolbarWindow32", NULL);
TBBUTTON tButton;
SendMessage(AddressbarRight, TB_GETBUTTON, 0, (LPARAM)&tButton); // 0 == Home button
SendMessage(AddressbarRight, TB_HIDEBUTTON, tButton.idCommand, (LPARAM)MAKELONG(TRUE, 0)); // idCommand == 1
//SendMessage(AddressbarRight, TB_ENABLEBUTTON, tButton.idCommand, (LPARAM)MAKELONG(FALSE, 0)); // makes it inactive
Everybody says to use "DestroyWindow" or "EnableWindow" or whatever. These buttons are not windows, if I interpret "inspect" and "spyxx_amd64" output correctly.
Events:
https://learn.microsoft.com/en-us/windows/win32/controls/toolbar-control-reference
Functions:
https://learn.microsoft.com/en-us/windows/win32/api/commctrl
The ImageList_ functions don't work correctly though. Like I call "ImageList_Remove":
HIMAGELIST mlist=(HIMAGELIST)::SendMessage(AddressbarRight, TB_GETIMAGELIST, 0, 0);
ImageList_Remove(mlist, 0);
but the button is still visible when I hover over it, looks broken though. But the event:
SendMessage(AddressbarRight, TB_DELETEBUTTON, 0, 0);
removes the icon completely. forever. Besides, if you use events, you don't need to link to "comctl32".
Beware when deleting buttons! The index decreases, so you delete index 0, index 1 takes its index (becoming 0). So when deleting several buttons, go backwards, starting with the highest index.