]> repos.lx-s.de Git - winmute.git/commitdiff
Added new mute options.
authorAlexander Steinhöfer <github@lx-s.de>
Mon, 29 Jun 2020 08:40:36 +0000 (10:40 +0200)
committerAlexander Steinhöfer <github@lx-s.de>
Mon, 29 Jun 2020 08:40:36 +0000 (10:40 +0200)
New mute options are:
- On Suspend
- On Shutdown
- On Logoff

These options do not auto-restore the volume, when the PC restarted,
etc.

12 files changed:
Dist/WinMute.nuspec
Dist/bin/changelog.txt
Dist/bin/liesmich.html
Dist/bin/readme.html
WinMute/Settings.cpp
WinMute/Settings.h
WinMute/StdAfx.h
WinMute/WinMain.cpp
WinMute/WinMute.cpp
WinMute/WinMute.h
WinMute/res.rc
WinMute/resource.h

index 3f82aaa82180f6d90e67389e6444bbfb22226e51..04cf62de431c23ca82ed56147e266f6d7b58e87f 100644 (file)
@@ -3,27 +3,27 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
        <metadata>
                <id>winmute</id>
-               <version>1.4.4.20170814</version>
+               <version>1.4.6.20200424</version>
                <title>WinMute</title>
                <authors>Alexander Steinhöfer</authors>
                <owners>Alexander Steinhöfer</owners>
                <packageSourceUrl>https://github.com/lx-s/WinMute/releases</packageSourceUrl>
                <projectUrl>https://github.com/lx-s/WinMute/</projectUrl>
-               <iconUrl>https://cdn.rawgit.com/lx-s/WinMute/1.4.4/WinMute/app.ico</iconUrl>
+               <iconUrl>https://cdn.rawgit.com/lx-s/WinMute/1.4.6/WinMute/app.ico</iconUrl>
                <tags>winmute windows utility audio</tags>
                <summary>Automatic sound muter</summary>
                <description>WinMute automatically mutes your PC volume if you lock your screen or the screensaver is running.</description>
-               <copyright>© 2016, Alexander Steinhöfer</copyright>
-               <licenseUrl>https://cdn.rawgit.com/lx-s/WinMute/1.4.4/LICENSE</licenseUrl>
+               <copyright>© 2020, Alexander Steinhöfer</copyright>
+               <licenseUrl>https://cdn.rawgit.com/lx-s/WinMute/1.4.6/LICENSE</licenseUrl>
                <dependencies>
                        <dependency id="vcredist2017" />
                </dependencies>
        </metadata>
        <files>
                <file src="tools\**" target="tools" />
-               <file src="bin\WinMute.exe" target="bin" />
-               <file src="bin\WinMute.exe.gui" target="bin" />
-               <file src="bin\ScreensaverNotify.dll" target="bin" />
+               <file src="bin\x86\WinMute.exe" target="bin" />
+               <file src="bin\x86\WinMute.exe.gui" target="bin" />
+               <file src="bin\x86\ScreensaverNotify.dll" target="bin" />
                <file src="bin\changelog.txt" target="bin" />
                <file src="bin\license.txt" target="bin" />
                <file src="bin\liesmich.html" target="bin" />
index 315b10966f7a8965dc163ba25359cbcdc20e6569..865c80a1142ff0bc5aa74c96657c56c2300dbf7d 100644 (file)
@@ -1,3 +1,6 @@
+Version 1.5.0 (2020-xx-yy)
+ * Added support for mute on suspend, shutdown and logout
+   Automatic audio-restore is disabled for these events.
 Version 1.4.6 (2020-04-24)
  * Compiled with spectre migitations... just 'cause
  * Added "Support"-Link to About dialog
index 311d4eda2d118245a83b8d94cf205500c46a8047..e795c6cd7498431df9e3f6badc6223b76ce65779 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="de">
 <head>
    <meta charset="utf-8">
-   <title>WinMute 1.4.6 - Lies mich</title>
+   <title>WinMute 1.5.0 - Lies mich</title>
 
    <style type="text/css">
    <!--
    </style>
 </head>
 <body>
-   <h1>WinMute 1.4.6</h1>
+   <h1>WinMute 1.5.0</h1>
    <p class="copyright">&copy; Copyright 2020, Alexander Steinh&ouml;fer - <a href="http://www.lx-s.de">www.lx-s.de</a></p>
 
    <h2>Über</h2>
-   <p>WinMute schaltet Windows stumm, sobald sie ihren PC sperren oder sich der Bildschirmschoner einschaltet.</p>
+   <p>WinMute kann Windows automatisch stumm schalten, sobald</p>
+   <ol>
+    <li>Sie den PC sperren.</li>
+    <li>sich der Bildschirmschoner aktiviert.</li>
+    <li>der PC heruntergefahren wird.</li>
+    <li>Sie sich Abmelden.</li>
+    <li>der PC in den Ruhezustand geht.</li>
+   </ol>
 
    <p>
       Das ist vor allem in einer B&uuml;roumgebung n&uuml;tzlich, wenn Sie Ihren
       Schreibtisch verlassen, aber die Kollegen nicht mit Musik oder
-      sonstigen Ger&auml;uschen aus Ihrem Computer st&ouml;ren m&ouml;chten.
+      sonstigen Ger&auml;uschen aus Ihrem Computer st&ouml;ren m&ouml;chten
+      oder aber Sie bei der nächsten Präsentation sicher gehen möchten, dass
+      der Ton Stumm ist, sobald der PC hochgefahren wird.
    </p>
 
    <a name="requirements"></a>
       Wenn sie WinMute automatisch mit Windows starten m&ouml;chten,
       kopieren sie eine Verkn&uuml;pfung zur WinMute.exe in den &quot;Autostart&quot;
       Ordner, den sie im Startmen&uuml; unter &quot;Programme&quot; finden (um diesen
-         Ordner zu finden drücken sie Windows+R auf ihrer Tastatur und tippen dann
-         &quot;Shell:Startup&quot; in das Textfeld ein. Bestätigen sie das Fenster mit OK).
+      Ordner zu finden drücken sie Windows+R auf ihrer Tastatur und tippen dann
+      &quot;Shell:Startup&quot; in das Textfeld ein. Bestätigen sie das Fenster mit OK).
    </p>
 
    <h2>Deinstallation</h2>
    <p>
       Einfach die WinMute.exe und ScreensaverNotify.dll l&ouml;schen*. Zusätzlich legt WinMute in der Registry (regedit.exe)
-         im Verzeichnis HKEY_CURRENT_USER\Software\lx-systems\WinMute ab. Sollten sie die von WinMute
-         gespeicherten Einstellungen nichtmehr benötigen, können sie diese einfach entfernen.
+      im Verzeichnis HKEY_CURRENT_USER\Software\lx-systems\WinMute ab. Sollten sie die von WinMute
+      gespeicherten Einstellungen nichtmehr benötigen, können sie diese einfach entfernen.
    </p>
    <p>
-       * Es kann sein, dass sich diese dll nicht sofort löschen lässt. Bei einem Fehler probieren sie es einfach
-         spätestens beim nächsten Neustart erneut. Diese Unannehmlichkeit ist leider eine Windows-Limitierung.
+    * Es kann sein, dass sich diese dll nicht sofort löschen lässt. Bei einem Fehler probieren sie es einfach
+      spätestens beim nächsten Neustart erneut. Diese Unannehmlichkeit ist leider eine Windows-Limitierung.
   </p>
 
    <h2>Benutzung</h2>
    <p>
       Sobald das Programm l&auml;uft, wird die
       Lautst&auml;rke automatisch auf 0 gedreht, sobald Sie den PC sperren
-         oder sich der Bildschirmschoner aktiviert.
+      oder sich der Bildschirmschoner aktiviert.
       Wenn Sie wieder an den PC zurückkehren, wird die Lautst&auml;rke auf den
-         urspr&uuml;nglichen Wert zur&uuml;ckgestellt.
+      urspr&uuml;nglichen Wert zur&uuml;ckgestellt.
    </p><p>
       Wenn dieses Verhalten kurzzeitig deaktiviert werden soll, k&ouml;nnen
       Sie dies &uuml;ber einen Rechtsklick auf das Taskbar-Icon bei der Uhr
       erreichen, indem sie den Haken bei &quot;Mute on Workstation lock&quot; bzw.
-         &quot;Mute on Screensaver start&quot; tentfernen.
+      &quot;Mute on Screensaver start&quot; tentfernen.
    </p>
 </body>
 </html>
index b402373c04c1d9f7afb181c70032e19dc34003d6..d46ffe7b8bd14c39fc169d976a3eb60e65c42026 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="en">
 <head>
    <meta charset="utf-8">
-   <title>WinMute 1.4.6 - Readme</title>
+   <title>WinMute 1.5.0 - Readme</title>
 
    <style type="text/css">
    <!--
    </style>
 </head>
 <body>
-   <h1>WinMute 1.4.6</h1>
+   <h1>WinMute 1.5.0</h1>
    <p class="copyright">&copy; Copyright 2020, by Alexander Steinh&ouml;fer - <a href="http://www.lx-s.de">www.lx-s.de</a></p>
 
    <h2>About</h2>
-   <p>WinMute automatically mutes your PC volume if you lock your screen or the screensaver is running.</p>
+   <p>WinMute automatically can mute your volume when</p>
+   <ol>
+    <li>You lock your PC.</li>
+    <li>The screensaver turns on.</li>
+    <li>Your PC shuts down</li>
+    <li>You log off</li>
+    <li>Your PC goes to sleep</li>
+   </ol>
 
    <p>
       This is very helpful e.g. if you leave your desk and don't want
       to annoy your co-workers with random sounds or music from
-      your computer.
+      your computer or don't want music blasting out of your speakers,
+      the next time you power on your pc during a presentation.
    </p>
 
    <a name="requirements"></a>
       If you want WinMute to automatically start with your windows,
       just create a shortcut to the winmute.exe file in the "Startup"
       folder located in your Windows Startmenu (to open this folder,
-         press Win+R and enter "Shell:Startup", then click "OK").
+      press Win+R and enter "Shell:Startup", then click "OK").
    </p>
 
    <h2>Uninstalling WinMute</h2>
    <p>
       Just delete the WinMute.exe and ScreensaverNotify.dll* file from your hard drive.
-         If you want to also remove your personal WinMute settings, then open
-         the registry (regedit.exe) and delete the Folder located in
-         HKEY_CURRENT_USER\Software\lx-systems\WinMute.
+      If you want to also remove your personal WinMute settings, then open
+      the registry (regedit.exe) and delete the Folder located in
+      HKEY_CURRENT_USER\Software\lx-systems\WinMute.
    </p>
    <p>
-       * It can happen, that you cannot remove this DLL file right away.
-         If you get an error trying to remove it, just wait until your next reboot
-         and delete it afterwards. This is unfortunately a windows limitation.
+    * It can happen, that you cannot remove this DLL file right away.
+      If you get an error trying to remove it, just wait until your next reboot
+      and delete it afterwards. This is unfortunately a windows limitation.
    </p>
 
    <h2>Usage</h2>
    <p>Start it and that's it!</p>
    <p>
       Whenever you lock your screen from now on or the screensaver starts,
-         WinMute will automatically mute your windows volume, and unmute it
-         right away when you come back to your pc.<br>
+      WinMute will automatically mute your windows volume, and unmute it
+      right away when you come back to your pc.<br>
       If you want to disable this behaviour temporary, right-click
-         on the taskbar notification icon and uncheck the menu item
-         "Mute on Workstationlock" / "Mute on Screensaver start".
+      on the taskbar notification icon and uncheck the menu item
+      "Mute on Workstationlock" / "Mute on Screensaver start".
    </p>
 </body>
 </html>
index f1c946ea76083cbe822ca931ea715312bd5e5414..f5ed751cf378b433d64fa92727266da0bf054d13 100644 (file)
@@ -50,6 +50,14 @@ static LPCWSTR KeyToStr(SettingsKey key)
    case SettingsKey::RESTORE_AUDIO:
       keyStr = _T("RestoreAudio");
       break;
+   case SettingsKey::MUTE_ON_SUSPEND:
+      keyStr = _T("MuteOnSuspend");
+      break;
+   case SettingsKey::MUTE_ON_SHUTDOWN:
+      keyStr = _T("MuteOnShutdown");
+      break;
+   case SettingsKey::MUTE_ON_LOGOUT:
+      keyStr = _T("MuteOnLogout");
    }
    return keyStr;
 }
@@ -130,4 +138,4 @@ bool Settings::SetValue(SettingsKey key, DWORD value)
       return false;
    }
    return true;
-}
\ No newline at end of file
+}
index 790dd0b1135916935fa14c4ab6e645bcc9b1db02..4d11c37124b937ec7d2b5bbdb05fcefaf2d890c1 100644 (file)
@@ -36,9 +36,12 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "StdAfx.h"
 
 enum class SettingsKey {
-   MUTE_ON_LOCK,
-   MUTE_ON_SCREENSAVER,
-   RESTORE_AUDIO
+     MUTE_ON_LOCK
+   , MUTE_ON_SCREENSAVER
+   , RESTORE_AUDIO
+   , MUTE_ON_SUSPEND
+   , MUTE_ON_SHUTDOWN
+   , MUTE_ON_LOGOUT
 };
 
 class Settings {
@@ -57,4 +60,4 @@ public:
 
 private:
    HKEY hRegSettingsKey_;
-};
\ No newline at end of file
+};
index 4c351a2443cc39cd98cf18050b2d1938d230220e..0a2387558178c1d194f9596ac152dfc46480daa1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  WinMute
-           Copyright (c) 2017, Alexander Steinhoefer
+           Copyright (c) 2020, Alexander Steinhoefer
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
index a5bd361fd4b49df7228b1bcddfec9c59be7bc894..0a9826d0c16d4dc873dfa4f2e0d6c419ac4c58de 100644 (file)
@@ -1,6 +1,6 @@
 /*
  WinMute
-           Copyright (c) 2017, Alexander Steinhoefer
+           Copyright (c) 2020, Alexander Steinhoefer
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
index 3b17c216727115e778b8c8cc48639067ecd6923d..2ad4db2e43fd13d03b5033b8073faa25ce304ea1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  WinMute
-           Copyright (c) 2017, Alexander Steinhoefer
+           Copyright (c) 2020, Alexander Steinhoefer
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -60,14 +60,13 @@ static LRESULT CALLBACK WinMuteWndProc(HWND hWnd, UINT msg, WPARAM wParam,
 
 WinMute::MuteConfig::MuteConfig()
 {
-   this->withRestore.muteOnLock = true;
-   this->withRestore.muteOnScreensaver = true;
-   this->withRestore.muteOnRemoteSession = true;
+   this->withRestore.onLock = true;
+   this->withRestore.onScreensaver = true;
    this->restoreAudio = true;
 
-   this->noRestore.muteOnLogoff = false;
-   this->noRestore.muteOnSuspend = false;
-   this->noRestore.muteOnShutdown = false;
+   this->noRestore.onLogoff = false;
+   this->noRestore.onSuspend = false;
+   this->noRestore.onShutdown = false;
 }
 
 WinMute::WinMute() :
@@ -129,7 +128,9 @@ bool WinMute::InitAudio()
    return true;
 }
 
-#define CHECK_MENU_ITEM(cond) (cond) ? MF_CHECKED : MF_UNCHECKED
+#define CHECK_MENU_ITEM(id, cond)                                              \
+   (CheckMenuItem(hTrayMenu_, ID_TRAYMENU_ ## id,                              \
+                  (cond) ? MF_CHECKED : MF_UNCHECKED) != -1)
 bool WinMute::InitTrayMenu()
 {
    hTrayMenu_ = LoadMenu(hglobInstance, MAKEINTRESOURCE(IDR_TRAYMENU));
@@ -137,12 +138,12 @@ bool WinMute::InitTrayMenu()
       PrintWindowsError(_T("LoadMenu"));
       return false;
    } else if (
-      CheckMenuItem(hTrayMenu_, ID_TRAYMENU_MUTEONLOCK,
-         CHECK_MENU_ITEM(muteConfig_.withRestore.muteOnLock)) == -1 ||
-      CheckMenuItem(hTrayMenu_, ID_TRAYMENU_MUTEONSCREENSAVER,
-         CHECK_MENU_ITEM(muteConfig_.withRestore.muteOnScreensaver)) == -1 ||
-      CheckMenuItem(hTrayMenu_, ID_TRAYMENU_RESTOREAUDIO,
-         CHECK_MENU_ITEM(muteConfig_.restoreAudio)) == -1) {
+      !CHECK_MENU_ITEM(MUTEONLOCK, muteConfig_.withRestore.onLock) ||
+      !CHECK_MENU_ITEM(MUTEONSCREENSAVER, muteConfig_.withRestore.onScreensaver) ||
+      !CHECK_MENU_ITEM(RESTOREAUDIO, muteConfig_.restoreAudio) ||
+      !CHECK_MENU_ITEM(MUTEONSUSPEND, muteConfig_.noRestore.onSuspend) ||
+      !CHECK_MENU_ITEM(MUTEONSHUTDOWN, muteConfig_.noRestore.onShutdown) ||
+      !CHECK_MENU_ITEM(MUTEONLOGOUT, muteConfig_.noRestore.onLogoff)) {
       return false;
    }
    return true;
@@ -168,7 +169,7 @@ bool WinMute::Init()
       return false;
    }
 
-   if (muteConfig_.withRestore.muteOnScreensaver) {
+   if (muteConfig_.withRestore.onScreensaver) {
       if (!scrnSaverNoti_.ActivateNotifications(hWnd_)) {
          return false;
       }
@@ -194,12 +195,20 @@ bool WinMute::Init()
 
 bool WinMute::LoadDefaults()
 {
-   muteConfig_.withRestore.muteOnLock =
+   muteConfig_.withRestore.onLock =
       settings_.QueryValue(SettingsKey::MUTE_ON_LOCK, 1) != 0;
-   muteConfig_.withRestore.muteOnScreensaver =
+   muteConfig_.withRestore.onScreensaver =
       settings_.QueryValue(SettingsKey::MUTE_ON_SCREENSAVER, 1) != 0;
    muteConfig_.restoreAudio =
       settings_.QueryValue(SettingsKey::RESTORE_AUDIO, 1) != 0;
+
+   muteConfig_.noRestore.onLogoff =
+      settings_.QueryValue(SettingsKey::MUTE_ON_LOGOUT, 0) != 0;
+   muteConfig_.noRestore.onSuspend =
+      settings_.QueryValue(SettingsKey::MUTE_ON_SUSPEND, 0) != 0;
+   muteConfig_.noRestore.onShutdown =
+      settings_.QueryValue(SettingsKey::MUTE_ON_SHUTDOWN, 0) != 0;
+
    return true;
 }
 
@@ -235,11 +244,21 @@ LRESULT CALLBACK WinMute::WindowProc(HWND hWnd, UINT msg,
       case ID_TRAYMENU_EXIT:
          SendMessage(hWnd, WM_CLOSE, 0, 0);
          break;
+      case ID_TRAYMENU_MUTE: {
+         bool state = false;
+         ToggleMenuCheck(ID_TRAYMENU_MUTE, &state);
+         if (!state) {
+            audio_->UnMute();
+         } else {
+            audio_->Mute();
+         }
+         break;
+      }
       case ID_TRAYMENU_MUTEONLOCK:
          ToggleMenuCheck(ID_TRAYMENU_MUTEONLOCK,
-                         &muteConfig_.withRestore.muteOnLock);
+                         &muteConfig_.withRestore.onLock);
          settings_.SetValue(SettingsKey::MUTE_ON_LOCK,
-                            muteConfig_.withRestore.muteOnLock);
+                            muteConfig_.withRestore.onLock);
          break;
       case ID_TRAYMENU_RESTOREAUDIO:
          ToggleMenuCheck(ID_TRAYMENU_RESTOREAUDIO, &muteConfig_.restoreAudio);
@@ -248,32 +267,33 @@ LRESULT CALLBACK WinMute::WindowProc(HWND hWnd, UINT msg,
          break;
       case ID_TRAYMENU_MUTEONSCREENSAVER:
          ToggleMenuCheck(ID_TRAYMENU_MUTEONSCREENSAVER,
-                         &muteConfig_.withRestore.muteOnScreensaver);
+                         &muteConfig_.withRestore.onScreensaver);
          settings_.SetValue(SettingsKey::MUTE_ON_SCREENSAVER,
-                            muteConfig_.withRestore.muteOnScreensaver);
-         if (muteConfig_.withRestore.muteOnScreensaver) {
+                            muteConfig_.withRestore.onScreensaver);
+         if (muteConfig_.withRestore.onScreensaver) {
             scrnSaverNoti_.ActivateNotifications(hWnd_);
          } else {
             scrnSaverNoti_.ClearNotifications();
          }
          break;
       case ID_TRAYMENU_MUTEONSHUTDOWN:
+         ToggleMenuCheck(ID_TRAYMENU_MUTEONSHUTDOWN,
+                         &muteConfig_.noRestore.onShutdown);
+         settings_.SetValue(SettingsKey::MUTE_ON_LOGOUT,
+                            muteConfig_.noRestore.onShutdown);
           break;
       case ID_TRAYMENU_MUTEONSUSPEND:
-          break;
-      case ID_TRAYMENU_MUTEONLOGOFF:
-          break;
-      case ID_TRAYMENU_MUTE: {
-         bool state = false;
-         ToggleMenuCheck(ID_TRAYMENU_MUTE, &state);
-         if (!state) {
-            audio_->UnMute();
-         } else {
-            audio_->Mute();
-         }
+         ToggleMenuCheck(ID_TRAYMENU_MUTEONSUSPEND,
+                         &muteConfig_.noRestore.onSuspend);
+         settings_.SetValue(SettingsKey::MUTE_ON_SUSPEND,
+                            muteConfig_.noRestore.onSuspend);
+         break;
+      case ID_TRAYMENU_MUTEONLOGOUT:
+         ToggleMenuCheck(ID_TRAYMENU_MUTEONLOGOUT,
+                         &muteConfig_.noRestore.onLogoff);
+         settings_.SetValue(SettingsKey::MUTE_ON_LOGOUT,
+                            muteConfig_.noRestore.onLogoff);
          break;
-      } default:
-         __assume(0);
       }
       return 0;
    }
@@ -302,45 +322,47 @@ LRESULT CALLBACK WinMute::WindowProc(HWND hWnd, UINT msg,
       static bool wasAlreadyMuted = false;
       if (wParam == WTS_SESSION_LOCK) {
          wasAlreadyMuted = audio_->IsMuted();
-         if (!wasAlreadyMuted && muteConfig_.withRestore.muteOnLock) {
+         if (!wasAlreadyMuted && muteConfig_.withRestore.onLock) {
             audio_->Mute();
          }
       } else if (wParam == WTS_SESSION_UNLOCK) {
          if (!wasAlreadyMuted &&
              muteConfig_.restoreAudio &&
-             muteConfig_.withRestore.muteOnLock) {
+             muteConfig_.withRestore.onLock) {
             audio_->UnMute();
          }
-      } else if (wParam == WTS_SESSION_LOGOFF) {
-          if (muteConfig_.noRestore.muteOnLogoff) {
-              audio_->Mute();
-          }
-      } else if (wParam == WTS_REMOTE_DISCONNECT) {
-          wasAlreadyMuted = audio_->IsMuted();
-          if (!wasAlreadyMuted &&
-              muteConfig_.withRestore.muteOnRemoteSession) {
-              audio_->Mute();
-          }
-      } else if (wParam == WTS_REMOTE_DISCONNECT) {
-          if (!wasAlreadyMuted &&
-              muteConfig_.restoreAudio &&
-              muteConfig_.withRestore.muteOnRemoteSession) {
-              audio_->UnMute();
-          }
       }
       return 0;
    }
+   case WM_POWERBROADCAST:
+      if (wParam == PBT_APMSUSPEND) {
+         if (muteConfig_.noRestore.onSuspend) {
+            audio_->Mute();
+         }
+      }
+      break;
+   case WM_QUERYENDSESSION:
+      if (lParam == 0) { // Shutdown
+         if (muteConfig_.noRestore.onShutdown) {
+            audio_->Mute();
+         }
+      } else if (lParam == ENDSESSION_LOGOFF) {
+         if (muteConfig_.noRestore.onLogoff) {
+            audio_->Mute();
+         }
+      }
+      break;
    case WM_SCRNSAVE_CHANGE: {
       static bool wasAlreadyMuted = false;
       if (wParam == SCRNSAVE_START) {
          wasAlreadyMuted = audio_->IsMuted();
-         if (!wasAlreadyMuted && muteConfig_.withRestore.muteOnScreensaver) {
+         if (!wasAlreadyMuted && muteConfig_.withRestore.onScreensaver) {
             audio_->Mute();
          }
       } else if (wParam == SCRNSAVE_STOP) {
          if (!wasAlreadyMuted && 
              muteConfig_.restoreAudio &&
-             muteConfig_.withRestore.muteOnScreensaver) {
+             muteConfig_.withRestore.onScreensaver) {
             audio_->UnMute();
          }
       }
index 11bfeea2b7322eee395d030b99b211ae59468f90..c721893f44ed688ef7f2942cba75d346594d9ce6 100644 (file)
@@ -56,16 +56,15 @@ private:
    struct MuteConfig {
       MuteConfig();
       struct {
-         bool muteOnLock;
-         bool muteOnScreensaver;
-         bool muteOnRemoteSession;
+         bool onLock;
+         bool onScreensaver;
       } withRestore;
+      bool restoreAudio;
       struct {
-         bool muteOnLogoff;
-         bool muteOnShutdown;
-         bool muteOnSuspend;
+         bool onLogoff;
+         bool onShutdown;
+         bool onSuspend;
       } noRestore;
-      bool restoreAudio;
    } muteConfig_;
 
    TrayIcon trayIcon_;
index 674104e2bc3303ca487875fae8c7cad10e3c01a2..ef9f7d239b1c70563c97abe06deb1836e3243f7c 100644 (file)
@@ -60,8 +60,12 @@ BEGIN
         MENUITEM "... Workstation is locked",   ID_TRAYMENU_MUTEONLOCK, CHECKED
         MENUITEM "... Screensaver starts",      ID_TRAYMENU_MUTEONSCREENSAVER, CHECKED
         MENUITEM SEPARATOR
-        MENUITEM "Afterwards...",               ID_TRAYMENU_AFTERWARDS, INACTIVE
-        MENUITEM "... Restore volume",          ID_TRAYMENU_RESTOREAUDIO, CHECKED
+        MENUITEM "... Restore volume when returning", ID_TRAYMENU_RESTOREAUDIO, CHECKED
+        MENUITEM SEPARATOR
+        MENUITEM "Mute on (no volume restore)...", ID_TRAYMENU_AFTERWARDS, INACTIVE
+        MENUITEM "... Shutdown",                ID_TRAYMENU_MUTEONSHUTDOWN
+        MENUITEM "... Sleep",                   ID_TRAYMENU_MUTEONSUSPEND
+        MENUITEM "... Logout",                  ID_TRAYMENU_MUTEONLOGOUT
         MENUITEM SEPARATOR
         MENUITEM "Mute now",                    ID_TRAYMENU_MUTE
         MENUITEM SEPARATOR
@@ -81,7 +85,7 @@ CAPTION "About WinMute"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,194,7,50,14
-    LTEXT           "WinMute v1.4.6",IDC_STATIC,43,9,67,11
+    LTEXT           "WinMute v1.5.0",IDC_STATIC,43,9,67,11
     CONTROL         "<a href=""https://lx-s.de"">lx-systems - lx-s.de</a>",IDC_LINK_HOMEPAGE,
                     "SysLink",WS_TABSTOP,43,35,69,13
     LTEXT           "Copyright © 2020, Alexander Steinhöfer",IDC_STATIC,43,22,148,12
@@ -117,8 +121,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,4,6,0
- PRODUCTVERSION 1,4,6,0
+ FILEVERSION 1,5,0,0
+ PRODUCTVERSION 1,5,0,0
  FILEFLAGSMASK 0x17L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -134,24 +138,24 @@ BEGIN
         BLOCK "000004b0"
         BEGIN
             VALUE "CompanyName", "lx-systems"
-            VALUE "FileDescription", "Automatic volume muting, when PC is locked."
-            VALUE "FileVersion", "1.4.6.0"
+            VALUE "FileDescription", "Automatic volume muting."
+            VALUE "FileVersion", "1.5.0.0"
             VALUE "InternalName", "WinMute"
             VALUE "LegalCopyright", "Copyright (c) 2020, Alexander Steinhöfer"
             VALUE "OriginalFilename", "WinMute.exe"
             VALUE "ProductName", "WinMute"
-            VALUE "ProductVersion", "1.4.6.0"
+            VALUE "ProductVersion", "1.5.0.0"
         END
         BLOCK "040704b0"
         BEGIN
             VALUE "CompanyName", "lx-systems"
-            VALUE "FileDescription", "Automatisches Stummschalten beim Sperren der Workstation."
-            VALUE "FileVersion", "1.4.6.0"
+            VALUE "FileDescription", "Automatisches Stummschalten des PCs."
+            VALUE "FileVersion", "1.5.0.0"
             VALUE "InternalName", "WinMute"
             VALUE "LegalCopyright", "Copyright (c) 2020, Alexander Steinhöfer"
             VALUE "OriginalFilename", "WinMute.exe"
             VALUE "ProductName", "WinMute"
-            VALUE "ProductVersion", "1.4.6.0"
+            VALUE "ProductVersion", "1.5.0.0"
         END
     END
     BLOCK "VarFileInfo"
index 9c34587f5f0516f7012fdd40a9cf6d6c9c46f895..ca7cab9b48f01118e50de085e602bc762ab151d0 100644 (file)
 #define ID_TRAYMENU_40011               40011
 #define ID_TRAYMENU_MUTEON              40012
 #define ID_TRAYMENU_AFTERWARDS          40013
+#define ID_TRAYMENU_MUTEONSUSPEND       40014
+#define ID_TRAYMENU_40015               40015
+#define ID_TRAYMENU_SPECIAL             40016
+#define ID_SPECIAL_MUTEWHEN             40017
+#define ID_TRAYMENU_40018               40018
+#define ID_TRAYMENU_40019               40019
+#define ID_TRAYMENU_40020               40020
+#define ID_TRAYMENU_MUTEONSHUTDOWN      40021
+#define ID_TRAYMENU_MUTEONSLEEP         40022
+#define ID_TRAYMENU_MUTEONLOGOFF        40023
+#define ID_TRAYMENU_MUTEONLOGOUT        40024
+#define ID_TRAYMENU_40025               40025
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        108
-#define _APS_NEXT_COMMAND_VALUE         40014
+#define _APS_NEXT_COMMAND_VALUE         40026
 #define _APS_NEXT_CONTROL_VALUE         1002
 #define _APS_NEXT_SYMED_VALUE           101
 #endif