Example #1
0
        private bool HandleSteamBigPicture(WindowMonitor.Event @event)
        {
            if (_steamProfile == null || @event.WindowName != "Steam" || @event.WindowClass != "CUIEngineWin32")
            {
                return(false);
            }

            if (_steamStateBeforeSwitchingBigPicture == null)
            {
                _steamBigPictureHandle = @event.Hwnd;
                var communication = _audioSwitcher.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eCommunications);
                var playback      = _audioSwitcher.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
                var recording     = _audioSwitcher.GetDefaultAudioEndpoint(EDataFlow.eCapture, ERole.eMultimedia);

                _steamStateBeforeSwitchingBigPicture = new Profile
                {
                    AlsoSwitchDefaultDevice = true,
                    Name               = SettingsStrings.profile_trigger_steam_msg,
                    Communication      = communication,
                    Playback           = playback,
                    Recording          = recording,
                    NotifyOnActivation = true
                };
            }

            SwitchAudio(_steamProfile);
            return(true);
        }
 public Event(uint processId, string processName, string windowName, string windowClass, User32.NativeMethods.HWND hwnd)
 {
     ProcessId   = processId;
     ProcessName = processName;
     WindowName  = windowName;
     WindowClass = windowClass;
     Hwnd        = hwnd;
 }
Example #3
0
 public WindowDestroyedEvent(User32.NativeMethods.HWND hwnd)
 {
     Hwnd = hwnd;
 }
        public static (uint ProcessId, string WindowText, string WindowClass) ProcessWindowInformation(User32.NativeMethods.HWND hwnd)
        {
            return(ComThread.Invoke(() =>
            {
                uint processId = 0;
                var wndText = "";
                var wndClass = "";
                try
                {
                    wndText = User32.GetWindowText(hwnd);
                }
                catch (Exception)
                {
                    // ignored
                }

                try
                {
                    wndClass = User32.GetWindowClass(hwnd);
                }
                catch (Exception)
                {
                    // ignored
                }

                try
                {
                    User32.NativeMethods.GetWindowThreadProcessId(hwnd, out processId);
                }
                catch (Exception)
                {
                    // ignored
                }


                return (processId, wndText, wndClass);
            }));
        }
Example #5
0
 public static extern int RegisterShellHookWindow(User32.NativeMethods.HWND hWnd);