[idd] helper: use Resources.h for icon IDs

This commit is contained in:
Quantum
2026-06-06 01:44:09 -04:00
committed by Geoffrey McRae
parent ffffff0740
commit 89ddab9d57
7 changed files with 40 additions and 6 deletions

View File

@@ -35,7 +35,6 @@ bool CConfigWindow::registerClass()
{
WNDCLASSEX wx = {};
populateWindowClass(wx);
wx.hIconSm = wx.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
wx.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
wx.lpszClassName = L"LookingGlassIddConfig";

View File

@@ -20,6 +20,7 @@
#include "CNotifyWindow.h"
#include "CConfigWindow.h"
#include "Resources.h"
#include <CDebug.h>
#include <windowsx.h>
#include <strsafe.h>
@@ -156,7 +157,7 @@ void CNotifyWindow::registerIcon()
m_iconData.hWnd = m_hwnd;
m_iconData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_SHOWTIP;
m_iconData.uCallbackMessage = WM_NOTIFY_ICON;
m_iconData.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
m_iconData.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ID_MAIN_ICON));
m_iconData.uVersion = NOTIFYICON_VERSION_4;
StringCbCopy(m_iconData.szTip, sizeof m_iconData.szTip, L"Looking Glass (IDD)");

View File

@@ -22,6 +22,7 @@
#include <windowsx.h>
#include <strsafe.h>
#include <CDebug.h>
#include "Resources.h"
HINSTANCE CWindow::hInstance = (HINSTANCE)GetModuleHandle(NULL);
@@ -30,8 +31,8 @@ void CWindow::populateWindowClass(WNDCLASSEX &wx)
wx.cbSize = sizeof(WNDCLASSEX);
wx.lpfnWndProc = wndProc;
wx.hInstance = hInstance;
wx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ID_MAIN_ICON));
wx.hIconSm = wx.hIcon;
wx.hCursor = LoadCursor(NULL, IDC_ARROW);
wx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
}

View File

@@ -211,6 +211,7 @@ copy /Y "$(ProjectDir)VERSION" "$(SolutionDir)$(Platform)\$(Configuration)\LGIdd
<ClInclude Include="CRegistrySettings.h" />
<ClInclude Include="CStaticWidget.h" />
<ClInclude Include="CWidget.h" />
<ClInclude Include="Resources.h" />
<ClInclude Include="UIHelpers.h" />
<ClInclude Include="CWindow.h" />
</ItemGroup>

View File

@@ -100,6 +100,9 @@
<ClInclude Include="CCheckbox.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resources.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
@@ -109,4 +112,7 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
<ItemGroup>
<Manifest Include="HighDPI.manifest" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,25 @@
/**
* Looking Glass
* Copyright © 2017-2026 The Looking Glass Authors
* https://looking-glass.io
*
* This program 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 2 of the License, or (at your option)
* any later version.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#define ID_MAIN_ICON 1
#define ID_GPU_ICON 2
#define ID_NO_GPU_ICON 3

View File

@@ -22,8 +22,9 @@
#include "winuser.h"
#include "winver.h"
#include "VersionInfo.h"
#include "Resources.h"
IDI_APPLICATION ICON "../../resources/icon.ico"
ID_MAIN_ICON ICON "../../resources/icon.ico"
#define STRINGIFY2(s) L#s
#define STRINGIFY(s) STRINGIFY2(s)