方案一:基于句柄与分辨率控制
using UnityEngine;
using System;
using System.Collections;
using System.Runtime.InteropServices;
public class WindowsSET : MonoSingleton<WindowsSET>
{
#region 窗口最小化定义
[DllImport("user32.dll")]
static extern bool CloseWindow(IntPtr hwnd);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
private IntPtr windowHandle = FindWindow(null, "Voices");
#endregion
private bool isChange = false;
public void CloseBtn_Click()
{
Application.Quit();
}
{
CloseWindow(windowHandle);
}
{
(isChange == )
{
Screen.SetResolution(, , );
}
{
Screen.SetResolution(, , );
}
isChange = !isChange;
}
}