RegCreateKey可以建立subkey,怎么建立呢?
RegCreateKey可以建立subkey,怎么建立呢? --------------------编程问答--------------------Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long--------------------编程问答-------------------- http://topic.csdn.net/t/20040916/17/3380303.html --------------------编程问答-------------------- 使用RegCreateKeyEx --------------------编程问答-------------------- RegCreateKeyEx怎么弄呢? --------------------编程问答-------------------- Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition 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 RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Sub Command1_Click()
openregery
End Sub
Private Sub openregery()
Dim ret As Long, hKey As Long, hKey2 As Long
ret = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft", hKey)
If ret = 0 Then
MsgBox "HKLM\SOFTWARE\Microsoft = " & hKey
End If
ret = RegOpenKey(hKey, "Windows\CurrentVersion", hKey2)
If ret = 0 Then
MsgBox "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion = " & hKey2
End If
'Use RegCreateKey function to create subkey "HKEY_LOCAL_MACHINE\SOFTWARE\Hongqt"
ret = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Hongqt", hKey)
If Not ret Then
MsgBox "新建 HKEY_LOCAL_MACHINE\SOFTWARE\Hongqt SubKey 成功"
Else
MsgBox "新建子键的操作失败"
End If
RegCloseKey hKey
RegCloseKey hKey2
End Sub
这个注册怎么报错呢,报错内容:用户定义类型未定义
补充:VB , 基础类