+ typedef BOOL(__stdcall *SetConsoleIconFun)(HICON);
+ bool success = false;
+ if (const SetConsoleIconFun pSetConsoleIconFun = MUtils::Win32Utils::resolve<SetConsoleIconFun>(QLatin1String("kernel32"), QLatin1String("SetConsoleIcon")))
+ {
+ const DWORD before = GetLastError();
+ qWarning("[Before: 0x%08X]", before);
+ if (pSetConsoleIconFun(hIcon))
+ {
+ success = true;
+ }
+ else
+ {
+ const DWORD error = GetLastError();
+ qWarning("SetConsoleIcon() has failed! [Error: 0x%08X]", error);
+ }
+ }
+ if (!success)
+ {
+ const HWND hwndConsole = GetConsoleWindow();
+ if ((hwndConsole != NULL) && (hwndConsole != INVALID_HANDLE_VALUE))
+ {
+ SendMessage(hwndConsole, WM_SETICON, ICON_SMALL, LPARAM(hIcon));
+ success = true;
+ }
+ }
+ if (success)