From 6565b4117c817d4cd99af277693a332d6dfa8970 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Tue, 6 Aug 2019 21:52:17 -0700 Subject: [PATCH] Set main window icon correctly --- FCHost/fchost/fchost_handler_win.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/FCHost/fchost/fchost_handler_win.cc b/FCHost/fchost/fchost_handler_win.cc index d92b24b0e21..6089e0bbf04 100644 --- a/FCHost/fchost/fchost_handler_win.cc +++ b/FCHost/fchost/fchost_handler_win.cc @@ -8,9 +8,21 @@ #include <string> #include "include/cef_browser.h" +#include "resource.h" void FCHostHandler::PlatformTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title) { CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle(); + + static bool haveSetIcon = false; + if (!haveSetIcon) + { + HICON hicon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FCHOST)); + SendMessage(hwnd, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(hicon)); + SendMessage(hwnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(hicon)); + DestroyIcon(hicon); + haveSetIcon = true; + } + SetWindowText(hwnd, std::wstring(title).c_str()); } -- GitLab