从注册表的某个节点倒出一个.reg的注册表文件,双击该文件windows可将其恢复到注册表中,请
问用代码怎么实现之?

解决方案 »

  1.   

    查了以前的文章,用shell可以把reg倒入,但是有些节点倒入不了,比如:
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\Root\MODEM
    如过没有MODEM,要增加也不行,请问怎么办?
      

  2.   

    http://www.pcdog.com/tech/html/2004424/24420046714_1.htm
    http://www.21tx.com/school/asp/wz/37WR450KZZZZ1NJCHS.shtml
      

  3.   

    Private Const HKEY_CLASSES_ROOT = &H80000000
    Private Const ERROR_SUCCESS = 0&
    Private Const REG_SZ = 1Private 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 Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPrivate Sub Command1_Click()Dim hKey As Long
    Dim ret As Long
    Dim str as String
    str = "atxthxiufoqr452fbgdr4if"ret = RegCreateKey(HKEY_CLASSES_ROOT, "Licenses\9FD745D6-4105-4EAF-B01A-E3F3BE4B3A9D", hKey)
    If Not ret Then
        If RegSetValueEx(hKey, "@", 0, REG_SZ, str, Len(str) + 1) <> ERROR_SUCCESS Then
        End If
        RegCloseKey (hKey)
    End IfEnd Sub