这需要将要启动的应用程序路径写到注册表中具体的路径是:
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)
正文