From 43776889b65690ed503913e8ef04b81326f9320f Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sat, 7 Jun 2014 18:56:49 +0100 Subject: [PATCH] Set title bar icon for CEF window. --- src/gui/handler.cpp | 8 ++++++++ src/gui/resource.h | 32 ++++++++++++++++++++++++++++++++ src/resource.rc | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/gui/resource.h diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index ab141087..db1b511c 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -23,6 +23,7 @@ */ #include "handler.h" +#include "resource.h" #include #include @@ -85,6 +86,13 @@ namespace loot { void LootHandler::OnAfterCreated(CefRefPtr browser) { assert(CefCurrentlyOn(TID_UI)); + // Set the title bar icon. + HWND hWnd = browser->GetHost()->GetWindowHandle(); + HANDLE hIcon = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(MAINICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); + HANDLE hIconSm = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(MAINICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm); + // Add to the list of existing browsers. browser_list_.push_back(browser); } diff --git a/src/gui/resource.h b/src/gui/resource.h new file mode 100644 index 00000000..62e56a4c --- /dev/null +++ b/src/gui/resource.h @@ -0,0 +1,32 @@ +/* LOOT + +A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and +Fallout: New Vegas. + +Copyright (C) 2014 WrinklyNinja + +This file is part of LOOT. + +LOOT is free software: you can redistribute +it and/or modify it under the terms of the GNU General Public License +as published by the Free Software Foundation, either version 3 of +the License, or (at your option) any later version. + +LOOT is distributed in the hope that it will +be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with LOOT. If not, see +. +*/ + +#ifndef __LOOT_GUI_RESOURCE__ +#define __LOOT_GUI_RESOURCE__ + +#include + +#define MAINICON 101 + +#endif diff --git a/src/resource.rc b/src/resource.rc index ab100b2e..72218516 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -1,4 +1,4 @@ -#include +#include "gui/resource.h" 1 VERSIONINFO FILEVERSION 0,6,0,0 PRODUCTVERSION 0,6,0,0