写入注册表,给你我的例子,右键菜单中的选择开机运行的菜单项事件
Private Const startdir As String = "Software\Microsoft\Windows\CurrentVersion\Run" '初始化注册表中随机启动路径和提示信息
Private Sub MIauto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MIauto.Click
'判断是否在开机时自动运行
Dim regkey As RegistryKey = Registry.CurrentUser.OpenSubKey(startdir, True)
With regkey
If MIauto.Checked Then
.DeleteValue(标识, False)
Else
.SetValue(标识, 你的程序所在路径,文件要加上exe后缀哦)
End If
End With
MIauto.Checked = Not MIauto.Checked
End Sub
[此贴子已经被作者于2005-5-15 13:24:27编辑过]