您的位置:首页 >> 编程开发 >> .NET >> VB.NET >> 正文
VB.NET RSS
 

VB6如何让程序开机就自动启动

http://www.rdxx.com 04年02月12日 09:14 互连网 我要投稿

关键词: 自动启动 , 开机 , VB6 , 程序 , 启动 , 自动 , VB
这需要将要启动的应用程序路径写到注册表中具体的路径是:
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)
正文 


 
 
标签: 自动启动 , 开机 , VB6 , 程序 , 启动 , 自动 , VB 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站