正文

VB6如何让程序开机就自动启动2006-01-17 20:59:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/wtblog/9696.html

分享到:

这需要将要启动的应用程序路径写到注册表中具体的路径是:
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run
只需要在上面的路径下写一个键并为此键设置一个当前应用程序的路径即开机自载
具体的方法:
1、将下面这段代码就是将键Clock写到注册表中:
  \'设置注册表内的RUN属性
  Dim strString As String
  Dim keyhand As Long
  Dim r As Long
  strString = App.Path & \"\\\" & App.EXEName & \".exe\"
  r = RegCreateKey(HKEY_LOCAL_MACHINE, \"software\\microsoft\\windows\\currentversion\\run\", keyhand)
  r = RegSetValueEx(keyhand, \"Clock\", 0, REG_SZ, ByVal strString, Len(strString))
  r = RegCloseKey(keyhand)
2、下面这段代码就是将注册表的Clock键删除
  \'删除注册表内的RUN属性
  Dim keyhand As Long
  r = RegOpenKey(HKEY_LOCAL_MACHINE, \"software\\microsoft\\windows\\currentversion\\run\", keyhand)
  r = RegDeleteValue(keyhand, \"Clock\")
  r = RegCloseKey(keyhand)

阅读(2872) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册