同意楼上.是呀,注册表编辑的那些API里都没这个功能^
纳闷中……

解决方案 »

  1.   

    这是我程序代码的一段,你看看吧
    Public Function EnumKey(hMainKey As Long, sSubKey As String, lIndex As Long, lpStr As String) As Boolean
    'EnumKey函数打开有hMainKey主键和sSubKey子键指定的注册键,lIndex为要查询的子键值
    '的索引,lpStr为放置子键值的字符串缓冲,如果要查询一个键值的所有子键,只要将lIndex
    '首先设置为0,然后将lIndex递增1再调用EnumKey函数,直到函数返回0为止
        Dim hKey As Long    '打开键的句柄
        Dim I As Long
        
        If RegOpenKey(hMainKey, sSubKey, hKey) = ERROR_SUCCESS Then
            lpStr = Space(255) + Chr(0)
            Debug.Print Len(lpStr)
            If RegEnumKey(hKey, lIndex, lpStr, Len(lpStr)) = ERROR_SUCCESS Then
                EnumKey = True
            Else
                EnumKey = False
            End If
        Else
            EnumKey = False
        End If
        RegCloseKey hKey
    End Function
    Public Function DeleteKey(lPredefinedKey As Long, sKeyName As String)
    'DeleteKey函数打开有hPredfineKeyKey主键和sKeyName子键指定的注册键,再将此子键删除
        Dim lRetVal As Long
        Dim hKey As Long         '打开键的句柄
            
        lRetVal = RegOpenKeyEx(lPredefinedKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
        lRetVal = RegDeleteKey(lPredefinedKey, sKeyName)
        RegCloseKey (hKey)
    End FunctionPublic Function DeleteValue(lPredefinedKey As Long, sKeyName As String, sValueName As String)
    'DeleteValue函数删除一个值
        Dim lRetVal As Long
        Dim hKey As Long     '打开键的句柄
        
        lRetVal = RegOpenKeyEx(lPredefinedKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
        lRetVal = RegDeleteValue(hKey, sValueName)
        RegCloseKey (hKey)
    End FunctionPublic Function SetValueEx(ByVal hKey As Long, sValueName As String, lType As Long, vValue As Variant) As Long
    'SetValueEx函数设置值
    '如果参数为REG_SZ则设置的值为字符串
    '如果参数为REG_WORD设置的值为整数值
        Dim lValue As Long
        Dim sValue As String    Select Case lType
            Case REG_SZ
                sValue = vValue
                SetValueEx = RegSetValueExString(hKey, sValueName, 0&, lType, sValue, Len(sValue))
            Case REG_DWORD
                lValue = vValue
                SetValueEx = RegSetValueExLong(hKey, sValueName, 0&, lType, lValue, 4)
            End Select
    End FunctionFunction QueryValueEx(ByVal lhKey As Long, ByVal szValueName As String, vValue As Variant) As Long
        Dim cch As Long
        Dim lrc As Long
        Dim lType As Long
        Dim lValue As Long
        Dim sValue As String    On Error GoTo QueryValueExError    lrc = RegQueryValueExNULL(lhKey, szValueName, 0&, lType, 0&, cch)
        If lrc <> ERROR_NONE Then Error 5    Select Case lType
            '查询字符串值
            Case REG_SZ:
                sValue = String(cch, 0)
                lrc = RegQueryValueExString(lhKey, szValueName, 0&, lType, sValue, cch)
                If lrc = ERROR_NONE Then
                    vValue = Left$(sValue, cch)
                Else
                    vValue = Empty
                End If        '查询整数值
            Case REG_DWORD:
                lrc = RegQueryValueExLong(lhKey, szValueName, 0&, lType, lValue, cch)
                If lrc = ERROR_NONE Then vValue = lValue
            Case Else
                lrc = -1
        End SelectQueryValueExExit:    QueryValueEx = lrc
        Exit FunctionQueryValueExError:    Resume QueryValueExExitEnd Function
    Public Function CreateNewKey(lPredefinedKey As Long, sNewKeyName As String)
    ' Description:
    ' 这个函数建立一个新的键
        Dim hNewKey As Long         '打开新键的句柄
        Dim lRetVal As Long
        
        lRetVal = RegCreateKeyEx(lPredefinedKey, sNewKeyName, 0&, vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0&, hNewKey, lRetVal)
        RegCloseKey (hNewKey)
    End FunctionPublic Function SetKeyValue(lPredefinedKey As Long, sKeyName As String, sValueName As String, vValueSetting As Variant, lValueType As Long)
           Dim lRetVal As Long
           Dim hKey As Long         '打开键的句柄       lRetVal = RegOpenKeyEx(lPredefinedKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
           lRetVal = SetValueEx(hKey, sValueName, lValueType, vValueSetting)
           RegCloseKey (hKey)
    End FunctionPublic Function QueryValue(lPredefinedKey As Long, sKeyName As String, sValueName As String)
           Dim lRetVal As Long
           Dim hKey As Long         '打开键的句柄
           Dim vValue As Variant      'setting of queried value
           lRetVal = RegOpenKeyEx(lPredefinedKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
           lRetVal = QueryValueEx(hKey, sValueName, vValue)
           QueryValue = vValue
           RegCloseKey (hKey)
    End Function
      

  2.   

    是不是有没有公开的函数???一般来讲,WINDOWS系统操作能实现的应用级操作(像设置墙纸,开关机),都应该是有API函数可以实现的,注册表编辑器自身都能实现“重命名”,难道它也是“复制,删除,重建,粘贴”出来的吗??请出手吧,高手