vb.net编写开机启动的程序怎么写
vb.net吧
全部回复
仅看楼主
level 9
1johnn 楼主
编写一软件需要开机启动,请问一下怎么写,网上找的不管用。
2013年04月24日 14点04分 1
level 7
这不是VB特有的功能,有很多做法,你可以把程序放到开始菜单中启动的列表中就可以自动启动,但是如果你的程序需要延时间可以用Bat文件来进行延时启动,如果你的程序不需要界面,还可以把程序写成windows服务程序,这样开机就可以自动启动
2013年04月24日 15点04分 2
就是写入注册表的那一种,可以通过软件按钮取消的
2013年04月24日 15点04分
level 13
win32类里面不是有一堆注册表的函数吗,在msdn看看。
2013年04月25日 01点04分 3
可是还是不会写啊............
2013年04月25日 16点04分
level 9
1johnn 楼主
这样改好了不知道是不是
正确的

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim reg As RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
If reg.GetValue("WindowsApplication1.exe") IsNot Nothing Then
If MessageBox.Show("改键已经存在,需要删除吗?", "提示", MessageBoxButtons.YesNo) = DialogResult.Yes Then
reg.DeleteValue("WindowsApplication1.exe", True)
MessageBox.Show("删除成功!")
End If
Else
reg.SetValue("WindowsApplication1.exe", Application.StartupPath + "\WindowsApplication1.exe")
MessageBox.Show("设置成功!")
End If
reg.Close()
reg = Nothing
End Sub
2013年05月01日 11点05分 4
1