禁止/恢复向开始的文档中保存历史记录
*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;
}