lx-s / WinMute

WinMute lets you automatically mute your PC volume on certain events (e. g. Screensaver, Workstation Lock, Shutdown, etc.).
BSD 3-Clause "New" or "Revised" License
168 stars 6 forks source link

Request: Mute during RDP Session #10

Closed shawngmc closed 2 years ago

shawngmc commented 2 years ago

I was wondering if it would be possible to add muting while an RDP session is active.

There is a Win32 function to detect this state in User32.lib:

#include <windows.h>
#pragma comment(lib, "user32.lib")

BOOL IsRemoteSession(void)
{
   return GetSystemMetrics( SM_REMOTESESSION );
}

See https://docs.microsoft.com/en-us/windows/win32/termserv/detecting-the-terminal-services-environment?redirectedfrom=MSDN

This would be helpful for when I'm remoting into my PC and don't want IM notifications blaring in the house.

lx-s commented 2 years ago

Hi Shawn, thanks for looking up the relevant API (Leaving this here: https://docs.microsoft.com/en-us/windows/win32/termserv/detecting-the-terminal-services-environment for me later)

About your scenario: When you login to your RDP session, was the user session already running or is it started with your login? If its the former, I have to add logic to detect when the current session changes to a remote session. If its the latter, WinMute can ust read SM_REMOTESESSION once on startup.

lx-s commented 2 years ago

Added. If you want to try it out, you can download the pre-release version "1.9.9.2".