///<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("没有找到投屏目标显示器"); } }
/// <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}"); }