首页新闻找找看学习计划

Winfrom中如何做到托盘图标向360那样,无论切换那个windwos账户,360托盘图标都能看到

0
悬赏园豆:10 [已解决问题] 解决于 2018-09-10 10:50

例如现在我用administrator登陆时启动图中exe程序,现在切换到guest账号,上图中的exe在进程中存在,但是托盘图标看不到了

逆光迷矢的主页 逆光迷矢 | 初学一级 | 园豆:188
提问于:2018-08-08 17:28

将可执行文件注册为开机启动项,

逆光迷矢 1年前
< >
分享
最佳答案
0

private static void RegisterAutoStart()
{
string path = Application.ExecutablePath;
string shortFileName = "NUCBox";
RegistryKey rgkRun = Registry.LocalMachine.OpenSubKey("SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run", true);
if (rgkRun == null)
{
rgkRun = Registry.LocalMachine.CreateSubKey("SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run");
}
string rgkValue = rgkRun.GetValue("NUCBox") as string;
if (string.IsNullOrEmpty(rgkValue))
{
rgkRun.SetValue(shortFileName, $""{path}"");
}
rgkRun.Close();
}

    private static void UnregisterAutoStart()
    {
        string path = Application.ExecutablePath;
        string shortFileName = "NUCBox";
        RegistryKey rgkRun = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run", true);
        if (rgkRun == null)
        {
            rgkRun = Registry.LocalMachine.CreateSubKey("SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run");
        }
        rgkRun.DeleteValue(shortFileName, false);
        rgkRun.Close();
    }
逆光迷矢 | 初学一级 |园豆:188 | 2018-09-10 10:46
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册