; rtn = RegOpenKeyEx(RootKey, SubKey, 0, KEY_WRITE, hKey) ''''open the key If rtn = ERROR_SUCCESS Then ''''if the key could be opened then rtn = RegDeleteKey(hKey, Key) ''''delete the key Else rtn = RegCloseKey(hKey) ''''close the key SysRegControl = False Exit Function End If ''''========================================================================================= Case regDeleteValues ''''=116 ''''删除键值 '''' ''''此处KeyValue,regKeyType为保留字,可以设为任意值,调用示例: ''''SysRegControl regHKEY_LOCAL_MACHINE, "jadgekylin\jklpos", "pos", 0, regTypeDword, regDeleteValues ''''=========================================================================================
rtn = RegOpenKeyEx(RootKey, SubKey, 0, KEY_WRITE, hKey) ''''open the key If rtn = ERROR_SUCCESS Then rtn = RegDeleteValue(hKey, Key) Else rtn = RegCloseKey(hKey) SysRegControl = False Exit Function End If ''''========================================================================================= Case regOther ''''=120 ''''保留操作ID ''''========================================================================================= ''''========================================================================================= Case Else ''''========================================================================================= SysRegControl = False Exit Function End Select ''''end if ''''RootKey On Error GoTo 0 SysRegControl = True Exit Function
RegOptionError: ''''错误处理过程 ''''If an error does accurr, and the user wants error messages displayed, then ''''display one of the following error messages
Dim lErrorCode As Long Dim GetErrorMsg As String lErrorCode = Err() Select Case lErrorCode Case 1009, 1015 GetErrorMsg = "The Registry Database is corrupt!" Case 2, 1010 GetErrorMsg = "Bad Key Name" Case 1011 GetErrorMsg = "Can''''t Open Key" Case 4, 1012 GetErrorMsg = "Can''''t Read Key" Case 5 GetErrorMsg = "Access to this key is denied" Case 1013 GetErrorMsg = "Can''''t Write Key" Case 8, 14 GetErrorMsg = "Out of memory" Case 87 GetErrorMsg = "Invalid Parameter" Case 234 GetErrorMsg = "There is more data than the buffer has been allocated to hold." Case Else GetErrorMsg = Chr(13) & Chr(10) & Error(Err()) End Select MsgBox "Error: " & Err() & GetErrorMsg Exit Function Resume
End Function
上一页 [1] [2] [3] 没有相关教程
|