赞
踩
1. 勾上下图标红处,发布后可防止按windows键缩小

2.发布后程序默认最小化
- using System;
- using System.Runtime.InteropServices;
- using UnityEngine;
-
- /// <summary>
- /// 开始时最小化窗口
- /// </summary>
- public class SetWindowMin : MonoBehaviour
- {
- [DllImport("user32.dll")]
- public static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
- [DllImport("user32.dll")]
- static extern IntPtr GetActiveWindow();
-
- const int SW_SHOWMINIMIZED = 2; //{最小化, 激活}
- const int SW_SHOWMAXIMIZED = 3;//最大化
- const int SW_SHOWRESTORE = 1;//还原
-
- private void Start()
- {
- ShowWindow(GetActiveWindow(), SW_SHOWMINIMIZED);
- }
- }

3.发布的程序只能开一个进程
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using UnityEngine;
-
- public class Process_sigle : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- //检测是否打开
- Process[] app = Process.GetProcessesByName("Da_Ping_show");
- if (app.Length >1)
- {
- for (int i =1; i < app.Length; i++)
- {
- app[i].Kill();
- }
- return;
- }
- }
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。