Example #1
0
 ///<summary>
 ///通过f-ar接口读取屏幕信息后设置窗口位置
 ///</summary>
 ///<param name="farwin">投屏窗口句柄</param>
 ///<param name="preview">是否为3D预览窗口</param>
 public void UpdateWindowPos(IntPtr farwin)
 {
     F3Device.Screen.Monitor monitor = F3Device.DeviceManager.Instance.FindProjectionMonitor(Global.Instance.Data.MainWindowHandle);
     if (monitor != null)
     {
         F3Device.Screen.RECT rect = monitor.m_MonitorInfo.rcMonitor;
         FARDll.MoveWindow(farwin, rect.Left, rect.Top, rect.Width, rect.Height, true);
     }
     else
     {
         UnityEngine.Debug.LogError("没有找到投屏目标显示器");
     }
 }
Example #2
0
    /// <summary>
    /// 打印显示器日志
    /// </summary>
    private void MonitorLog()
    {
        UnityEngine.Debug.Log($"显示器数量:{F3Device.DeviceManager.Instance.AllMonitors.Count}");
        UnityEngine.Debug.Log($"IsCloneProjection:{F3Device.DeviceManager.Instance.IsCloneProjection}");
        foreach (F3Device.Screen.Monitor monitor in F3Device.DeviceManager.Instance.AllMonitors)
        {
            F3Device.Screen.DisplayDevice device = monitor.m_DisplayDevice;
            F3Device.Screen.RECT          rect   = monitor.m_MonitorInfo.rcMonitor;

            UnityEngine.Debug.Log($"MonitorName:{monitor.m_Name} DeviceName:{device.m_DeviceName}");
            UnityEngine.Debug.Log($"Left:{rect.Left} Top:{rect.Top} Right:{rect.Right} Bottom:{rect.Bottom}");
            UnityEngine.Debug.Log($"PelsWidth:{device.m_DEVMODE.dmPelsWidth} PelsHeight:{device.m_DEVMODE.dmPelsHeight}");
            UnityEngine.Debug.Log($"PositionX:{device.m_DEVMODE.dmPosition.x} PositionY:{device.m_DEVMODE.dmPosition.y}");
        }
    }
Example #3
0
    /// <summary>
    /// 获取当前数据
    /// </summary>
    /// <param name="refreshF3Device">是否刷新显示设备信息</param>
    public void DoProcess(bool refreshF3Device = false)
    {
        //窗口范围
        GlobalData data = Global.Instance.Data;

        MainWindowRect       = WindowHelper.GetWindownRect(data.MainWindowHandle);
        ProjectionWindowRect = WindowHelper.GetWindownRect(data.ProjectionWindowHandle);

        //刷新显示设备列表
        if (refreshF3Device)
        {
            F3Device.DeviceManager.Instance.Refresh();
        }

        //显示器范围
        F3Device.Screen.Monitor        monitor;
        List <F3Device.Screen.Monitor> monitorList = null;

        monitorList = F3Device.DeviceManager.Instance.FindMonitors((int)MainWindowRect.xMin, (int)MainWindowRect.yMin, (int)MainWindowRect.xMax, (int)MainWindowRect.yMax);
        if (monitorList.Count != 0)
        {
            monitor = monitorList[0];
            F3Device.Screen.RECT rect = monitor.m_MonitorInfo.rcMonitor;
            MainMonitorRect = new Rect(rect.Left, rect.Top, rect.Width, rect.Height);
            MainDevice      = F3Device.DeviceManager.Instance.FindDevice(rect.Left, rect.Top, rect.Right, rect.Bottom);
        }
        else
        {
            MainMonitorRect = new Rect();
            MainDevice      = null;
        }
        monitorList = F3Device.DeviceManager.Instance.FindMonitors((int)ProjectionWindowRect.xMin, (int)ProjectionWindowRect.yMin, (int)ProjectionWindowRect.xMax, (int)ProjectionWindowRect.yMax);
        if (monitorList.Count != 0)
        {
            monitor = monitorList[0];
            F3Device.Screen.RECT rect = monitor.m_MonitorInfo.rcMonitor;
            ProjectionMonitorRect = new Rect(rect.Left, rect.Top, rect.Width, rect.Height);
            ProjectionDevice      = F3Device.DeviceManager.Instance.FindDevice(rect.Left, rect.Top, rect.Right, rect.Bottom);
        }
        else
        {
            ProjectionMonitorRect = new Rect();
            ProjectionDevice      = null;
        }

        DoProcessDevice();
    }
Example #4
0
        /// <summary>
        /// 自动适配GC一体机主屏位置
        /// </summary>
        public static void AutoGC()
        {
            System.IntPtr handle = F3Device.API.GetProcessWnd();
            if (handle == System.IntPtr.Zero)
            {
                UnityEngine.Debug.Log("主屏handle = null");
                return;
            }
            F3Device.Screen.Monitor monitor = F3Device.DeviceManager.Instance.FindGCMonitor();
            if (monitor == null)
            {
                UnityEngine.Debug.Log("没有找到GC显示器 FindGCMonitor = null");
                return;
            }

            F3Device.Screen.RECT rect = monitor.m_MonitorInfo.rcMonitor;
            bool res = F3Device.API.SetWindowPos(handle, 0, rect.Left, rect.Top, rect.Width, rect.Height, F3Device.API.SWP_NOZORDER | F3Device.API.SWP_SHOWWINDOW);

            UnityEngine.Debug.Log($"设置主屏位置 name:{monitor.m_Name} res:{res} left:{rect.Left} top:{rect.Top} width:{rect.Width} height:{rect.Height}");
        }