unity最小化程序窗口

using UnityEngine;
using System;
using System.Runtime.InteropServices;

public class MinSize : MonoBehaviour
{
    [DllImport("user32.dll")]
    public static extern bool ShowWindow(System.IntPtr hwnd, int nCmdShow);
    [DllImport("user32.dll", EntryPoint = "GetForegroundWindow")]
    public static extern System.IntPtr GetForegroundWindow();

    [DllImport("user32.dll", SetLastError = true)]
    private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);


    [DllImport("user32.dll")]
    private static extern bool EnableWindow(IntPtr hwnd, bool enable);
    [DllImport("user32.dll")]
    private static extern bool MoveWindow(IntPtr handle, int x, int y, int width,
    int height, bool redraw);


    
    void Start()
    {
        ShowWindow(FindWindow(null, "ReadQRcode"), 7);
    }

}

你可能感兴趣的:(Unity)