示例#1
0
        /// <summary>
        /// Find the streaming panel of PS4 Remote Play
        /// </summary>
        /// <param name="remotePlayProcess"></param>
        /// <returns></returns>
        public static IntPtr FindStreamingPanel(Process remotePlayProcess)
        {
            // Find panel in process
            var childHandles = WindowControl.GetAllChildHandles(remotePlayProcess.MainWindowHandle);
            var panelHandle  = childHandles.Find(ptr =>
            {
                var sb = new StringBuilder(50);
                WindowControl.GetClassName(ptr, sb, 50);
                var str = sb.ToString();
                return(str == "WindowsForms10.Window.8.app.0.141b42a_r9_ad1" || str == "WindowsForms10.Window.8.app.0.141b42a_r10_ad1");
            });

            // Try to find the best one possible instead
            if (panelHandle == IntPtr.Zero)
            {
                IntPtr biggestPanel = IntPtr.Zero;
                Rect   biggestSize  = new Rect();
                foreach (var ptr in childHandles)
                {
                    Rect rect = new Rect();
                    WindowControl.GetWindowRect(ptr, ref rect);

                    if (rect.Bottom - rect.Top >= biggestSize.Bottom - biggestSize.Top)
                    {
                        biggestPanel = ptr;
                        biggestSize  = rect;
                    }
                }

                panelHandle = biggestPanel;
            }

            return(panelHandle);
        }
示例#2
0
        public static IntPtr FindStreamingPanel(Process remotePlayProcess)
        {
            // Find panel in process
            var childHandles = WindowControl.GetAllChildHandles(remotePlayProcess.MainWindowHandle);
            var panelHandle  = childHandles.Find(ptr => {
                var sb = new StringBuilder(50);
                WindowControl.GetClassName(ptr, sb, 50);
                var str = sb.ToString();
                return(str == "WindowsForms10.Window.8.app.0.141b42a_r9_ad1" || str == "WindowsForms10.Window.8.app.0.141b42a_r10_ad1");
            });

            return(panelHandle);
        }