using System;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using IWshRuntimeLibrary;
public class StartMenu : MonoBehaviour
{
public Button setupStartupButton;
public Button cancelStartupButton;
public Text hintText;
private static string ShortcutName = "test.lnk";
private void OnEnable()
{
isStartup();
//OnSetupStartupButtonClick();
setupStartupButton.onClick.AddListener(OnSetupStartupButtonClick);
cancelStartupButton.onClick.AddListener(OnCancelStartupButtonClick);
}
private void OnDisable()
{
setupStartupButton.onClick.RemoveListener(OnSetupStartupButtonClick);
cancelStartupButton.onClick.RemoveListener(OnCancelStartupButtonClick);
}
private void OnSetupStartupButtonClick()
{
CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup), ShortcutName, System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
C#开机自启代码
最新推荐文章于 2023-09-14 21:18:47 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)