文件名称:開機自動運行您指定的程式
文件大小:36KB
文件格式:RAR
更新时间:2013-01-01 03:16:38
自動運行
Option Explicit Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value. Private Const HKEY_CURRENT_USER = &H80000001 Private Const REG_SZ = 1 Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value. Private Const HKEY_CURRENT_USER = &H80000001 Private Const REG_SZ = 1 Private Sub Form_Load() Dim SubKey As String Dim Exe As String Dim hKey As Long SubKey = "Software\Microsoft\Windows\CurrentVersion\Run" Exe = App.Path & "\color.exe" '你所要啟動的項目 RegCreateKey HKEY_CURRENT_USER, SubKey, hKey RegSetValueEx hKey, "你想要命名的名", 0, REG_SZ, ByVal Exe, LenB(StrConv(Exe, vbFromUnicode)) + 1 RegCloseKey hKey End Sub
【文件预览】:
開機自動運行
----Form1.frm(4KB)
----calc.exe(89KB)
----Project1.vbw(50B)
----開機自動運行()
--------Form1.frm(1KB)
--------color.exe(24KB)
--------Module1.bas(668B)
--------Project1.vbw(79B)
--------Project1.vbp(678B)
----Project1.vbp(637B)