在基于对话框的程序中如何用程序备份/还原注**册**表

解决方案 »

  1.   

    什么系统?
    如果是WIN98的话就简单了:
    把WINDOWS下的SYSTEM。DAT和USER。DAT的只读,隐藏属性去掉,
    复制到另外一个地方。
    还原时再复制回去,并设回原来的属性就行了。程序实现步骤:
    1.GetWindowsDirectory
    2.SetFileAttributes
    3.CopyFile
      

  2.   

    这里得几篇文章,希望有点用处,不过和对话框无关<some tips for registry programming>http://www.patching.net/bbs/bbs.asp?bordid=17
      

  3.   

    搜索了以前的帖子,问及此问题的不少,均无结果。本人给出注册表一个键的备份方法,关于遍历注册表的过程可以自己添加。API函数RegSaveKey的功能有限。
    #include<fstream>
    void C...Dlg::OnButton1() //注册表备份
    {
    std::ofstream tfile("C:\\...\\back.reg",std::ios::out);
    tfile<<"REFEDIT4\n\n"; tfile<<"[HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\]\n";
    tfile<<"\"Test1\" =\"Adam\"\n";
    tfile<<"\"Test2\"=hex:61\n";
    tfile<<"\"Test3\"=dword:00000064\n";
    tfile.close();
    }void C...Dlg::OnButton2() //注册表恢复
    {
    system("C:\\...\\back.reg");//请先备份注册表
    }
      

  4.   

    http://www.vckbase.com/document/viewdoc.asp?id=724
      

  5.   

    void CRegDlg::OnButton24() //注册表备份
    {
        ShellExecute(NULL,"open","C:\\Windows\\Regedit.exe","/e \"C:\\back.reg\"",NULL,SW_SHOWNORMAL);
    }
    void CRegDlg::OnButton25() //注册表恢复
    {
        ShellExecute(NULL,"open","C:\\Windows\\Regedit.exe","/s \"C:\\zzq.reg\"",NULL,SW_SHOWNORMAL);
    }