unity最小化程序窗口

来源:互联网 发布:mac os操作系统教程 编辑:程序博客网 时间:2024/06/04 23:19
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);    }}
原创粉丝点击