获取指定窗口,修改窗口类型,把边框去掉,
using System;
using System.Runtime.InteropServices;
using UnityEngine;public class WindowCtrl : MonoBehaviour
{
[SerializeField]
private Material m_Material;
[SerializeField]
private string strProduct;//要控制的窗口名字,需要和Build->BuildSetting->PlayerSetting->ProductName 一致,private struct MARGINS
{
public int cxLeftWidth;
public int cxRightWidth;
public int cyTopHeight;
public int cyBottomHeight;
}
private enum WindowSizeType
{
Null,
Normal,
MinSize,
MaxSize
}
//private WindowSizeType windowSize = WindowSizeType.Normal;
// Define function signatures to import from Windows APIs
[DllImport("user32.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
private static extern IntPtr GetActiveWindow();
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);
[DllImport("Dwmapi.dll")]
private static extern uint DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS margins);
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);//设置此窗体为活动窗体
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(I