注册表问题,很急,各位老大帮帮忙
Private lp As Long
Private Sub Command1_Click()
If RegCreateKey(HKEY_LOCAL_MACHINE, "software\devicegateconfig\chan16 ", lp) <> ERROR_SUCCESS Then
MsgBox ( "添加失败 ")
End If
End Sub
Private Sub Command2_Click()
If RegSetValueEx(lp, "IP ", 0&, REG_SZ, ByVal "192.168.1.233 ", Len(keyvalue) + 1) <> error_sruccess Then
MsgBox ( "失败 ")
End If
End Sub
Private Sub Command3_Click()
Dim stri As String
stri = Space(16)
Dim lpp As Long
MsgBox (lp)
If RegQueryValueEx(lp, "IP ", 0&, REG_SZ, ByVal stri, 16) <> ERROR_SUCCESS Then
MsgBox ( "失败 ")
End If
MsgBox (stri)
End Sub
为什么我写进注册表以后,读不出来 ,写成功了,就是读不出来
[解决办法]
'获取一个项的设置值
private Declare Function RegQueryValueEx Lib "advapi32.dll " _
Alias "RegQueryValueExA " (ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As Any, _
lpcbData As Long) As Long
你是这样定义的吗?