/// <summary> /// Called whenever the active window changes /// </summary> private void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { // Refresh List of Active Audio Apps RefreshActiveApps(); // Mute apps var focused = WindowUtil.GetActiveProcessName(); foreach (var app in MutedWindowStorage.Instance.Binding()) { VolumeMixer.SetApplicationMute(app, !app.Equals(focused)); } }