From bb8f227e5448e8a01372544067c9578cebf7bb6e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20Steinh=C3=B6fer?= Date: Fri, 18 Feb 2022 08:08:14 +0100 Subject: [PATCH] Bumped version to 1.7.0. Added dark tray icon. Added dark tray icon as well as a system theme detection logic to change the tray icon accordingly. Bumped the version to 1.7.0 and changed the manifest option to enable Hi DPI awareness. --- Dist/bin/changelog.txt | 4 ++ Dist/bin/liesmich.html | 6 +- Dist/bin/readme.html | 6 +- ScreensaverNotify/ScreensaverNotify.vcxproj | 2 +- .../ScreensaverNotify32.vcxproj | 2 +- ScreensaverProxy32/ScreensaverProxy32.vcxproj | 2 +- WinMute/StdAfx.h | 2 +- WinMute/Utility.cpp | 2 +- WinMute/WinMute.cpp | 57 +++++++++++++++++- WinMute/WinMute.vcxproj | 11 +++- WinMute/WinMute.vcxproj.filters | 7 ++- WinMute/app.ico | Bin 7406 -> 7406 bytes WinMute/res.rc | 29 ++++----- WinMute/resource.h | 4 +- WinMute/tray_bright.ico | Bin 0 -> 7406 bytes WinMute/{tray.ico => tray_dark.ico} | Bin 16 files changed, 105 insertions(+), 29 deletions(-) create mode 100644 WinMute/tray_bright.ico rename WinMute/{tray.ico => tray_dark.ico} (100%) diff --git a/Dist/bin/changelog.txt b/Dist/bin/changelog.txt index 97f6a16..7909c23 100644 --- a/Dist/bin/changelog.txt +++ b/Dist/bin/changelog.txt @@ -1,3 +1,7 @@ +Version 1.7.0-beta (2022-*-*) + * Added Hi-DPI Awareness to manifest + * Added Tray-Icon for bright system theme + Version 1.6.0 (2020-12-18) * Added "Quiet Hours": A time frame where WinMute automatically mutes and afterwards unmutes your workstation. diff --git a/Dist/bin/liesmich.html b/Dist/bin/liesmich.html index e5a2cef..8c5868a 100644 --- a/Dist/bin/liesmich.html +++ b/Dist/bin/liesmich.html @@ -2,7 +2,7 @@ - WinMute 1.6.0 - Lies mich + WinMute 1.7.0 - Lies mich -

WinMute 1.6.0

- +

WinMute 1.7.0

+

Über

WinMute kann Windows automatisch stumm schalten, sobald

diff --git a/Dist/bin/readme.html b/Dist/bin/readme.html index 144e712..f07c182 100644 --- a/Dist/bin/readme.html +++ b/Dist/bin/readme.html @@ -2,7 +2,7 @@ - WinMute 1.6.0 - Readme + WinMute 1.7.0 - Readme -

WinMute 1.6.0

- +

WinMute 1.7.0

+

About

WinMute can automatically mute your volume when

diff --git a/ScreensaverNotify/ScreensaverNotify.vcxproj b/ScreensaverNotify/ScreensaverNotify.vcxproj index 2206de8..e264a8e 100644 --- a/ScreensaverNotify/ScreensaverNotify.vcxproj +++ b/ScreensaverNotify/ScreensaverNotify.vcxproj @@ -188,7 +188,7 @@ true true Caret - stdcpp17 + stdcpp20 Windows diff --git a/ScreensaverNotify32/ScreensaverNotify32.vcxproj b/ScreensaverNotify32/ScreensaverNotify32.vcxproj index 86783e1..170e804 100644 --- a/ScreensaverNotify32/ScreensaverNotify32.vcxproj +++ b/ScreensaverNotify32/ScreensaverNotify32.vcxproj @@ -152,7 +152,7 @@ WINMUTEDLL_EXPORTS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true Caret - stdcpp17 + stdcpp20 Console diff --git a/ScreensaverProxy32/ScreensaverProxy32.vcxproj b/ScreensaverProxy32/ScreensaverProxy32.vcxproj index 5eeda92..446ea7f 100644 --- a/ScreensaverProxy32/ScreensaverProxy32.vcxproj +++ b/ScreensaverProxy32/ScreensaverProxy32.vcxproj @@ -145,7 +145,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 Windows diff --git a/WinMute/StdAfx.h b/WinMute/StdAfx.h index f914dc8..d04f373 100644 --- a/WinMute/StdAfx.h +++ b/WinMute/StdAfx.h @@ -93,6 +93,6 @@ inline void SafeRelease(Interface** ppInterfaceToRelease) #endif // Utility -void PrintWindowsError(LPTSTR lpszFunction, DWORD lastError = -1); +void PrintWindowsError(LPCWSTR lpszFunction, DWORD lastError = -1); static const LPCTSTR PROGRAM_NAME = _T("WinMute"); diff --git a/WinMute/Utility.cpp b/WinMute/Utility.cpp index 65df993..18361ea 100644 --- a/WinMute/Utility.cpp +++ b/WinMute/Utility.cpp @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "StdAfx.h" -void PrintWindowsError(LPTSTR lpszFunction, DWORD lastError) +void PrintWindowsError(LPCWSTR lpszFunction, DWORD lastError) { // Retrieve the system error message for the last-error code if (lastError == -1) { diff --git a/WinMute/WinMute.cpp b/WinMute/WinMute.cpp index 68cba13..6da378f 100644 --- a/WinMute/WinMute.cpp +++ b/WinMute/WinMute.cpp @@ -59,6 +59,40 @@ static LRESULT CALLBACK WinMuteWndProc(HWND hWnd, UINT msg, WPARAM wParam, : DefWindowProc(hWnd, msg, wParam, lParam); } +static int IsDarkMode(bool& isDarkMode) +{ + HKEY hKey; + int rc = 1; + //RegOpenCurrentUser + LSTATUS error = RegOpenKey( + HKEY_CURRENT_USER, + _T("Software\\Microsoft\\Windows\\CurrentVersion\\") + _T("Themes\\Personalize"), + &hKey); + if (error != ERROR_SUCCESS) { + PrintWindowsError(_T("RegOpenKey"), error); + } else { + DWORD isLightTheme = 0; + DWORD bufSize = sizeof(isLightTheme); + DWORD valType = 0; + error = RegQueryValueEx( + hKey, + _T("SystemUsesLightTheme"), + NULL, + &valType, + reinterpret_cast(&isLightTheme), + &bufSize); + if (error != ERROR_SUCCESS) { + PrintWindowsError(_T("RegQueryValueEx"), error); + } else { + isDarkMode = !isLightTheme; + rc = 0; + } + RegCloseKey(hKey); + } + return rc; +} + WinMute::MuteConfig::MuteConfig() { this->withRestore.onLock = true; @@ -198,7 +232,12 @@ bool WinMute::Init() return false; } - hTrayIcon_ = LoadIcon(hglobInstance, MAKEINTRESOURCE(IDI_TRAY)); + bool isDarkMode = true; + IsDarkMode(isDarkMode); + hTrayIcon_ = LoadIcon( + hglobInstance, + isDarkMode ? MAKEINTRESOURCE(IDI_TRAY_DARK) + : MAKEINTRESOURCE(IDI_TRAY_BRIGHT)); if (hTrayIcon_ == NULL) { PrintWindowsError(_T("LoadIcon")); return false; @@ -500,6 +539,22 @@ LRESULT CALLBACK WinMute::WindowProc( } return 0; } + case WM_SETTINGCHANGE: { + if (lstrcmp(LPCTSTR(lParam), L"ImmersiveColorSet") == 0) { + bool isDarkMode = true; + IsDarkMode(isDarkMode); + hTrayIcon_ = LoadIcon( + hglobInstance, + isDarkMode ? MAKEINTRESOURCE(IDI_TRAY_DARK) + : MAKEINTRESOURCE(IDI_TRAY_BRIGHT)); + if (hTrayIcon_ == NULL) { + PrintWindowsError(_T("LoadIcon")); + } else { + trayIcon_.ChangeIcon(hTrayIcon_); + } + } + return 0; + } default: if (msg == uTaskbarRestart) { // Restore trayicon if explorer.exe crashes trayIcon_.Hide(); diff --git a/WinMute/WinMute.vcxproj b/WinMute/WinMute.vcxproj index b46bde6..3e47fdc 100644 --- a/WinMute/WinMute.vcxproj +++ b/WinMute/WinMute.vcxproj @@ -138,6 +138,9 @@ MachineX86 + + PerMonitorHighDPIAware + @@ -159,6 +162,9 @@ true Windows + + PerMonitorHighDPIAware + @@ -259,11 +265,14 @@ - + + + + diff --git a/WinMute/WinMute.vcxproj.filters b/WinMute/WinMute.vcxproj.filters index 9cc447f..ce204de 100644 --- a/WinMute/WinMute.vcxproj.filters +++ b/WinMute/WinMute.vcxproj.filters @@ -108,7 +108,7 @@ Resource Files - + Resource Files @@ -117,4 +117,9 @@ Resource Files + + + Resource Files + + \ No newline at end of file diff --git a/WinMute/app.ico b/WinMute/app.ico index fb8d0d693063318d4f8dc10089cea3496f45072a..a1e22e804adb30ca0c31e8322ba12d447e1e1b5c 100644 GIT binary patch delta 26 ecmaE7`Ob2K6zgUM;b+WXVsZgX#pXEP3H$((cM13a delta 430 zcmaE7`Ob2K6e|-i@8m=lT^3#-05Y^EACu;voX?^_AuY?uJNcuu9+)(w&@4*b0@E+Y z%*zMzqYjkTgSv~21LS!Sn7l<=aq@m?4t5Back)(g1z=!sAQWtqmIn%OA_TTe%K-(r y5CS`-Wq|_R2!Wl_GC%lx-systems - lx-s.de",IDC_LINK_HOMEPAGE, "SysLink",WS_TABSTOP,43,35,69,13 - LTEXT "Copyright © 2020, Alexander Steinhöfer",IDC_STATIC,43,22,148,12 + LTEXT "Copyright � 2020, Alexander Steinh�fer",IDC_STATIC,43,22,148,12 ICON IDI_APP,IDC_STATIC,13,12,20,20,SS_CENTERIMAGE CONTROL "Support",IDC_LINK_SUPPORT, "SysLink",WS_TABSTOP,119,35,36,13 @@ -149,8 +149,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,6,0,0 - PRODUCTVERSION 1,6,0,0 + FILEVERSION 1,7,0,0 + PRODUCTVERSION 1,7,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -167,23 +167,23 @@ BEGIN BEGIN VALUE "CompanyName", "lx-systems" VALUE "FileDescription", "WinMute" - VALUE "FileVersion", "1.6.0.0" + VALUE "FileVersion", "1.7.0.0" VALUE "InternalName", "WinMute" - VALUE "LegalCopyright", "Copyright (c) 2021, Alexander Steinhöfer" + VALUE "LegalCopyright", "Copyright (c) 2022, Alexander Steinh�fer" VALUE "OriginalFilename", "WinMute.exe" VALUE "ProductName", "WinMute" - VALUE "ProductVersion", "1.6.0.0" + VALUE "ProductVersion", "1.7.0.0" END BLOCK "040704b0" BEGIN VALUE "CompanyName", "lx-systems" VALUE "FileDescription", "WinMute" - VALUE "FileVersion", "1.6.0.0" + VALUE "FileVersion", "1.7.0.0" VALUE "InternalName", "WinMute" - VALUE "LegalCopyright", "Copyright (c) 2021, Alexander Steinhöfer" + VALUE "LegalCopyright", "Copyright (c) 2022, Alexander Steinh�fer" VALUE "OriginalFilename", "WinMute.exe" VALUE "ProductName", "WinMute" - VALUE "ProductVersion", "1.6.0.0" + VALUE "ProductVersion", "1.7.0.0" END END BLOCK "VarFileInfo" @@ -202,7 +202,9 @@ END // remains consistent on all systems. IDI_APP ICON "app.ico" -IDI_TRAY ICON "tray.ico" +IDI_TRAY_DARK ICON "tray_dark.ico" + +IDI_TRAY_BRIGHT ICON "tray_bright.ico" ///////////////////////////////////////////////////////////////////////////// @@ -234,4 +236,3 @@ END ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED - diff --git a/WinMute/resource.h b/WinMute/resource.h index c8aaade..c03b640 100644 --- a/WinMute/resource.h +++ b/WinMute/resource.h @@ -7,7 +7,9 @@ #define IDI_APP 106 #define IDI_ICON1 107 #define IDI_TRAY 107 +#define IDI_TRAY_DARK 107 #define IDD_QUIETHOURS 108 +#define IDI_TRAY_BRIGHT 110 #define IDC_LINK_HOMEPAGE 1001 #define IDC_LINK_HOMEPAGE2 1002 #define IDC_LINK_SUPPORT 1002 @@ -50,7 +52,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 110 +#define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40029 #define _APS_NEXT_CONTROL_VALUE 1004 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/WinMute/tray_bright.ico b/WinMute/tray_bright.ico new file mode 100644 index 0000000000000000000000000000000000000000..fb4361ffe6909ca895eddeca847a91f634a65ca7 GIT binary patch literal 7406 zcmeI$L17{Ku_Bw~c%wwK_cvZ1}$dMOMD3o9!*c+0WSV=ypyvGmyBVN(hXNFW4q z842`YL=V9pghG31A(l`Wj9@@4q8pzz2MbLIDf`U2pZ{;(+imOFOZDyM_r9HZvoqg* zZ?nv<$cT)})Rb@=moLXf-r>=S6Gi*OS44iM@BI1l{Ocm`<1Ly~cn>2yFWtt9kd7l9 z4Y%p(X}NguqRf3TCzn3DB=c9U$o1>jWo2bWJ`F+EKU^*>7ac z-j%G`?aeh0`e&M%jyAXST60@BMK!x>`xM*COkucBDfcCG6?>F_>{D!SV*8S{wY9W2 z`EGk#e*f*!a9@(1R~@PfR2BG7RN#eu%F&B2=_s{_okwC1i%xq`{0&a0bAz)-<*32n za?qfeCVFnFqCGsDCbp>tbEmavJl9TxhwXCkuw9-Vw9A>x@NAy)yxtYjcSZWQMgIC) zZ%0$&bhuW8yg#P z>(;Hbc8pPWc6Q|9!-vx8bmZ~l$I|U~<@orR990}ycmzaPe%8sd;t>#`uz?ONEddb< zd$NNEDM*CECUo!!AQe&AA`Tt_5yh6;v9x0u$CQqzJBG3_$#?`rC@eV#kAMh;CG6l4 z5TURa;ouPvp|BU`;1Lj^U;$S4=^i*nD69Yu9sv;wD~dxvgu;sC;1Lj^u);Zb1VkvT zm<}ER5eg;1Vkv9fL!QDK!k!x$%TFdL?~E@TZ2 z?&aOK#qE4Q&37Z;CHAD1Z>HEjUbM)9wIcTGMeMbT*liba-|}Ew%7@4gcd5Nt###~k zZx*rFC}MZMi2Lbv^>nw4n`K-qW37n&dJ!jDMSP>3qVAV<+1)PMn|noEJS<`@PqAO8 d4whGox)4deVUgs6MUsDDF)Lrkb9GM7`y0Yl>AwH~ literal 0 HcmV?d00001 diff --git a/WinMute/tray.ico b/WinMute/tray_dark.ico similarity index 100% rename from WinMute/tray.ico rename to WinMute/tray_dark.ico -- 2.43.0