打印本文 打印本文 关闭窗口 关闭窗口
VB6如何让程序开机就自动启动
作者:武汉SEO闵涛  文章来源:敏韬网  点击数622  更新时间:2009/4/23 15:42:03  文章录入:mintao  责任编辑:mintao
这需要将要启动的应用程序路径写到注册表中具体的路径是:
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)
正文 

打印本文 打印本文 关闭窗口 关闭窗口