登录时 Clickonce 自动启动 [英] Clickonce auto start on login

查看:25
本文介绍了登录时 Clickonce 自动启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VB.NET 中创建了一个简单的 Dock.现在我想让它在用户安装它时,应用程序自动将自己添加到启动项中,以便在每次系统登录或重新启动后启动.

I created a simple dock in VB.NET. Now I want to make it so when the user installs it, the application automatically adds itself to the startup items so that it will start after every system login or restart.

我希望该解决方案适用于所有操作系统(Windows 7 到 Windows 10).

I want the solution to applicable for all OS'es (Windows 7 to Windows 10).

谢谢

推荐答案

您可以使用注册表来做到这一点:

以下代码将应用程序添加到启动中,在注册表中:

This code below adds the application to the startup, in the registry:

'variables
Dim name As String = Application.ProductName
Dim location As String = Application.ExecutablePath
'registry key
Dim regestry As Microsoft.Win32.RegistryKey
'adds key to registry
regestry = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regestry.SetValue(name, """" & location & """")
regestry.Close()

这需要管理员权限,这里有一个很好的教程:http://www.downloadinformer.com/2014/01/how-to-make-vbnet-application-always.html

This requires admin privileges, here is a good tutorial on that: http://www.downloadinformer.com/2014/01/how-to-make-vbnet-application-always.html

这篇关于登录时 Clickonce 自动启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆