Hey! I'm aware that this is an old tool, and it might not be updated anymore, but I've experienced a problem while working in Unity where the small icon doesn't change properly? I've got no problem with changing the large taskbar icon, it seems to work everytime, but the small icon either changes for a bit and then returns back into the default one, or it doesn't change at all. Thanks!
Viewing post in window_set_icon (GameMaker,C#,Unity) comments
I don’t have Unity installed right now, but that probably means that they decided to re-set the icon on their own.
You would need to add a window message hook that intercepts the attempts to change icon and passes your saved icons instead.
In the GameMaker/C++ version that looks like the following:
LRESULT window_command_proc_hook(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
if (msg == WM_SETICON && window_icon_hook.enable) {
HICON icon;
switch (wp) {
case ICON_SMALL:
icon = window_icon_hook.icons[0];
break;
case ICON_BIG:
icon = window_icon_hook.icons[1];
break;
default: icon = NULL;
}
if (icon != NULL) lp = (LPARAM)icon;
}
return CallWindowProc(window_icon_hook.base, hwnd, msg, wp, lp);
}
void window_icon_hook_ensure(HWND hwnd) {
if (window_icon_hook.base == nullptr) {
window_icon_hook.base = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)window_command_proc_hook);
}
}
As ever, all function signatures and typedefs can be taken from pinvoke.net