Option Explicit 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 Private Const REG_SZ = 1Private Sub Command1_Click() Dim hReg As Long, sName As String, sValue As String sName = "Application" sValue = "c:\dll.exe" RegCreateKey HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\dllexec\Parameters", hReg RegSetValueEx hReg, sName, ByVal 0, ByVal REG_SZ, ByVal sValue, ByVal Len(sValue) End Sub
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
Private Const REG_SZ = 1Private Sub Command1_Click()
Dim hReg As Long, sName As String, sValue As String
sName = "Application"
sValue = "c:\dll.exe"
RegCreateKey HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\dllexec\Parameters", hReg
RegSetValueEx hReg, sName, ByVal 0, ByVal REG_SZ, ByVal sValue, ByVal Len(sValue)
End Sub