当前位置: 代码迷 >> C语言 >> 禁止/恢复向开始的文档中保存历史记录
  详细解决方案

禁止/恢复向开始的文档中保存历史记录

热度:463   发布时间:2007-10-24 23:31:05.0
禁止/恢复向开始的文档中保存历史记录
*
Name: 禁止/恢复向开始的文档中保存历史记录
Copyright:
Author: 随心
Date: 15-10-07 14:06
Description:
*/
#include <iostream>
#include <cstdlib>
#include <process.h>
using namespace std;
char *regedit1={"Windows Registry Editor Version 5.00\n\n[HKEY_CURRENT_USER\
\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer]\n\"NoRecentDocsHistory\"=dword:1"};//dword:不能少了
char *regedit2={"Windows Registry Editor Version 5.00\n\n[HKEY_CURRENT_USER\
\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer]\n\"NoRecentDocsHistory\"=dword:00000000"};//否则改不了
int main()
{
int choice;
cout<<"======================================"<<endl;
cout<<"1 禁止开始的文档中保存历史记录"<<endl;
cout<<"2 恢复开始的文档中保存历史记录"<<endl;
cout<<"0 退出"<<endl;
cout<<"======================================"<<endl;
cout<<"choice:"<<flush;
cin>>choice;
switch(choice)
{
case 0:exit(0);break;
case 1:
{
FILE *output;
if(output=fopen("$$$$$","w"))
fprintf(output,regedit1);
fclose(output);
spawnl(1,"c:\\windows\\regedit.exe"," /s $$$$$",NULL);
cout<<"成功!"<<endl;
}
break;
case 2:
{
FILE *output;
if(output=fopen("$$$$$","w"))
fprintf(output,regedit2);
fclose(output);
spawnl(1,"c:\\windows\\regedit.exe"," /s $$$$$",NULL);
cout<<"成功!"<<endl;
}
break;
default : cout<<"error!"<<endl;
}
system("pause");
system("del $$$$$");
return 0;
}

搜索更多相关的解决方案: 文档中  历史  保存  记录  

----------------解决方案--------------------------------------------------------