MFC文件操作大全3

来源:互联网 发布:淘宝折扣平台 编辑:程序博客网 时间:2024/05/20 07:35

MFC文件操作大全3

43.递归删除目录下的文件
CString Directory(%%1);
CStringArray csa;
int count=0;
if(Directory.Right(1)!="//")
Directory+="//";
Directory+="*.*";
CFileFInd FFile;
csa.add(Directory);
while(count<csa.GetSize())
{
if(FFile.FindFile(csa.GetAt(i)))
{
bFound=FFile.FindNextFile();
if(!FFile.IsDirectory() && !FFile.IsDots())
{
DeleteFile(FFile.GetFilePath());
}
else if(FFile.IsDirectory())
{
csa.Add(FilePath+"//*.*");
}
}
else
count++;
}


44.验证DTD
//#include <stdexcept> // runtime_error
//#include <xercesc/sax2/DefaultHandler.hpp>
using namespace std;
using namespace xercesc;
try {
 // Initialize Xerces and obtain a SAX2 parser
 XercesInitializer init;
 auto_ptr<SAX2XMLReader> 
parser(XMLReaderFactory::createXMLReader());
 // Enable validation
 parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
 // Register error handler to receive notifications
 // of DTD violations
 CircusErrorHandler error;
 parser->setErrorHandler(&error);
 parser->parse("animals.xml");
} catch (const SAXException& e) {
cout << "xml error: " << toNative(e.getMessage()) << "/n";
 return EXIT_FAILURE;
} catch (const XMLException& e) {
 cout << "xml error: " << toNative(e.getMessage()) << "/n";
 return EXIT_FAILURE;
} catch (const exception& e) {
cout << e.what() << "/n";
return EXIT_FAILURE;


45.Schema 验证
//#include <xercesc/sax2/XMLReaderFactory.hpp>
//#include <xercesc/sax2/SAX2XMLReader.hpp>
//#include <xercesc/sax2/DefaultHandler.hpp>
// Handy definitions of constants.
#include <xercesc/util/XMLUni.hpp>
// Create a SAX2 parser object.
SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
// Set the appropriate features on the parser.
// Enable namespaces, schema validation, and the checking 
// of all Schema constraints.
// We refer to these as "common features" in following examples.
parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
parser->setFeature(XMLUni::fgXercesDynamic, false);
parser->setFeature(XMLUni::fgXercesSchema, true);
parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
// Set appropriate ContentHandler, ErrorHandler, and EntityResolver.
// These will be referred to as "common handlers" in subsequent examples.
// You will use a default handler provided by Xerces-C++ (no op action).
// Users should write their own handlers and install them.
DefaultHandler handler;
parser->setContentHandler(&handler);
// The object parser calls when it detects violations of the schema.
parser->setErrorHandler(&handler);
// The object parser calls to find the schema and 
// resolve schema imports/includes.
parser->setEntityResolver(&handler);
// Parse the XML document.
// Document content sent to registered ContentHandler instance.
parser->parse(xmlFile);
// Delete the parser instance.
delete parser;

46.Grep
void BrowseFile(CString strFile)
{
CFileFind ff;
CString szDir = strFile;
if(szDir.Right(1) != "//")
szDir += "//";
szDir += "*.*";
BOOL res = ff.FindFile(szDir);
while(res)
{
res = ff.FindNextFile();
if(ff.IsDirectory() && !ff.IsDots())//目录是文件夹
{
//如果是一个子目录,用递归继续往深一层找
CString strPath = ff.GetFilePath(); //得到路径,做为递归调用的开始
CString strTitle = ff.GetFileTitle();//得到目录名,做为树控的结点
BrowseFile(strPath);//递归调用
}
else if(!ff.IsDots()) 
{
//显示当前访问的文件
CString strPath;
strPath = ff.GetFilePath();
//AfxMessageBox(m_find_str);
findStrInFile(strPath);
//strTitle = ff.GetFileTitle();
}
}
ff.Close();//关闭


void findStrInFile(CString filePath)
{
FILE *fp;
char ch[256];
//char fpath[256];
// sprintf(fpath,"%s",filePath);
//CString temp;
//AfxMessageBox(fpath);
 fp = fopen(filePath,"r");
 while(!feof(fp))
 {
memset(ch, 0, sizeof(ch));
//AfxMessageBox("aaaa");
fgets((char *)ch, sizeof(ch)-1, fp);
if(strstr(ch,m_find_str))
{
m_find_res+=filePath+"/r/n";
fclose(fp);
//UpdateData(FALSE);
CString strTemp;
strTemp.Format("%d",resNum);
m_list_res.InsertItem(resNum,strTemp);
//strTemp.Empty();
//strTemp.Format("%d",100);
//char buf[128];
//sprintf(buf,"%d",100);//AfxMessageBox("aaaaa");
m_list_res.SetItemText(resNum,1,strTemp);
// memset(buf,0,100);
// sprintf(buf,"%s",filePath);
//AfxMessageBox("aaaaa");
m_list_res.SetItemText(resNum,2,filePath);
resNum++;
return;
}
//AfxMessageBox("aaaa");
//temp.Format(ch);
//AfxMessageBox(temp);
/*if(temp.Find(m_find_str))
{
m_find_res+=filePath+"/r/n";
fclose(fp);
return;
}*/
 }
 fclose(fp);


void OnOK_ToFind() 
{
UpdateData(TRUE);
m_find_path=Buffer;
//AfxMessageBox(m_find_path);
BrowseFile(m_find_path);
UpdateData(FALSE);
}
void OnButtonFindPath() 
{
//选择路径
 BROWSEINFO bi;
 memset(Buffer,0,MAX_PATH);
 //初始化入口参数bi开始
 bi.hwndOwner = NULL;
 bi.pidlRoot = NULL;
 bi.pszDisplayName = Buffer;//此参数如为NULL则不能显示对话框
 bi.lpszTitle = "选择路径";
 bi.ulFlags = 0;

bi.lpfn = NULL;
// bi.iImage=IDR_MAINFRAME;
 //初始化入口参数bi结束
 LPITEMIDLIST pIDList = SHBrowseForFolder(&bi);//调用显示选择对话框
 if(pIDList)
 {
SHGetPathFromIDList(pIDList, Buffer);
//取得文件夹路径到Buffer里
 }
 LPMALLOC lpMalloc;
 if(FAILED(SHGetMalloc(&lpMalloc))) return;
 //释放内存
 lpMalloc->Free(pIDList);
 lpMalloc->Release(); 

}
void OnButtonClear() 
{
m_find_path.Empty();
m_find_str.Empty();
m_find_res.Empty();
UpdateData(FALSE);
}

47.直接创建多级目录
/*
typedef BOOL (__stdcall funMakeSure(LPCSTR DirPath));
funMakeSure *MakeSureDirectoryPathExists;
HMODULE hMod=LoadLibrary("dbghelp.dll");
MakeSureDirectoryPathExists(*funMakeSure)GetProcAddress(hMod,"MakeSureDirectoryPathExists");
*/
MakeSureDirectoryPathExists(%%1);

48.批量重命名
CString strPath,strFilter,srcTitle,src,srcFile,dstFile,dstFileTitle;
int i=1,iFileNum=1;
CFile myFile,newFile;
//获取将要批量处理的文件夹及文件格式
GetDlgItemText(IDC_SRC,strPath);
GetDlgItemText(IDC_EXT,strFilter);
//判断文件夹是否为空
if(strPath.IsEmpty())
{
MessageBox("请先选择要重命名文件所在文件夹!","警告!");
return;
}
//在该文件夹内创建目录文件
src=strPath+"*."+strFilter;

CString list=strPath+"目录.txt";

if(myFile.Open(list,CFile::modeCreate|CFile::modeReadWrite,0) ==0) return;

CFileFind tempFind;
BOOL isFound=(BOOL)tempFind.FindFile(src);
//确定该文件夹内要处理的有多少个文件
while(isFound)
{
isFound=(BOOL)tempFind.FindNextFile();
if(tempFind.IsDirectory())
{
continue;
}
iFileNum++;
}
//进行文件名的转换,以文件数定转换后的文件名,如果有9个文件,则以1-9的形式命名,如果是更多,如有99个文件,则为01-99的形式
isFound=(BOOL)tempFind.FindFile(src);

while(isFound && i<iFileNum)
{
isFound=(BOOL)tempFind.FindNextFile();
if(tempFind.IsDirectory())
{
continue;
}
srcFile=tempFind.GetFilePath();
srcTitle=tempFind.GetFileTitle();

if(iFileNum<10)
{
dstFileTitle.Format("%d",i);
}
else if(iFileNum<100 && iFileNum>9)
{
dstFileTitle.Format("%02d",i);
}
else if(iFileNum<1000 && iFileNum>99)
{
dstFileTitle.Format("%03d",i);
}
else if(iFileNum<10000 && iFileNum>999)
{
dstFileTitle.Format("%04d",i);
}
else if(iFileNum<100000 && iFileNum>9999)
{
dstFileTitle.Format("%05d",i);
}
else
{
dstFileTitle.Format("%d",i);
}
//实现转换
dstFile=strPath+dstFileTitle+"."+strFilter;

MoveFile(srcFile,dstFile);
//存入目录文件中
CString in;
in=dstFileTitle+'/t'+srcTitle+"/t/r/n";
myFile.Write(in,in.GetLength());

i++;
SetWindowText(srcFile);
}
//关闭myFile,tempFind
myFile.Close();
tempFind.Close();

49.文本查找替换 ReplaceText
CString StrFileName(%%1);
CString StrFind(%%2);
CString StrReplace(%%3);
CStdioFile TempFile,File; 
int Count=0; 
if(!File.Open(StrFileName,CFile::modeRead)) 
return -1; 
CString StrTempFileName=File.GetFileTitle()+".tmp"; 
if(!TempFile.Open(StrTempFileName,CFile::modeCreate|CFile::modeReadWrite)) 
return -1; 
CString Str; 
while(File.ReadString(Str)) 

Count+=Str.Replace(StrFind,StrReplace); 
TempFile.WriteString(Str+"/n"); 

File.Close(); 
TempFile.Close(); 
CFile::Remove(StrFileName); 
CFile::Rename(StrTempFileName,StrFileName); 
//return Count; 

50.文件关联
//---------------------------------------------------------------------------
// 检测文件关联情况
// strExt: 要检测的扩展名(例如: ".txt")
// strAppKey: ExeName扩展名在注册表中的键值(例如: "txtfile")
// 返回TRUE: 表示已关联,FALSE: 表示未关联
BOOL CheckFileRelation(const char *strExt, const char *strAppKey)
{
 int nRet=FALSE;
 HKEY hExtKey;
 char szPath[_MAX_PATH]; 
 DWORD dwSize=sizeof(szPath); 
 if(RegOpenKey(HKEY_CLASSES_ROOT,strExt,&hExtKey)==ERROR_SUCCESS)
 {
 RegQueryValueEx(hExtKey,NULL,NULL,NULL,(LPBYTE)szPath,&dwSize);
 if(_stricmp(szPath,strAppKey)==0)
 {
 nRet=TRUE;
 }
 RegCloseKey(hExtKey);
 return nRet;
 }
 return nRet;
}

//---------------------------------------------------------------------------
// 注册文件关联
// strExe: 要检测的扩展名(例如: ".txt")
// strAppName: 要关联的应用程序名(例如: "C:/MyApp/MyApp.exe")
// strAppKey: ExeName扩展名在注册表中的键值(例如: "txtfile")
// strDefaultIcon: 扩展名为strAppName的图标文件(例如: "C:/MyApp/MyApp.exe,0")
// strDescribe: 文件类型描述
void RegisterFileRelation(char *strExt, char *strAppName, char *strAppKey, char *strDefaultIcon, char *strDescribe)
{
 char strTemp[_MAX_PATH];
 HKEY hKey;
 
 RegCreateKey(HKEY_CLASSES_ROOT,strExt,&hKey);
 RegSetValue(hKey,"",REG_SZ,strAppKey,strlen(strAppKey)+1);
 RegCloseKey(hKey);
 
 RegCreateKey(HKEY_CLASSES_ROOT,strAppKey,&hKey);
 RegSetValue(hKey,"",REG_SZ,strDescribe,strlen(strDescribe)+1);
 RegCloseKey(hKey);
 
 sprintf(strTemp,"%s//DefaultIcon",strAppKey);
 RegCreateKey(HKEY_CLASSES_ROOT,strTemp,&hKey);
 RegSetValue(hKey,"",REG_SZ,strDefaultIcon,strlen(strDefaultIcon)+1);
 RegCloseKey(hKey);
 
 sprintf(strTemp,"%s//Shell",strAppKey);
 RegCreateKey(HKEY_CLASSES_ROOT,strTemp,&hKey);
 RegSetValue(hKey,"",REG_SZ,"Open",strlen("Open")+1);
 RegCloseKey(hKey);
 
 sprintf(strTemp,"%s//Shell//Open//Command",strAppKey);
 RegCreateKey(HKEY_CLASSES_ROOT,strTemp,&hKey);
 sprintf(strTemp,"%s /"%%1/"",strAppName);
 RegSetValue(hKey,"",REG_SZ,strTemp,strlen(strTemp)+1);
 RegCloseKey(hKey);
}

51.操作Excel文件

52.设置JDK环境变量
class CRegEdit : public CObject
{
public:
HKEY m_RootKey;
HKEY m_hKey;
int m_EnumLoop;
public:
CRegEdit()
{
m_hKey=NULL;
m_RootKey=NULL;
}
~CRegEdit()
{
if (m_hKey!=NULL)
::RegCloseKey(m_hKey);
}
// CRegEdit 成员函数
BOOL OpenKey(LPCTSTR StrKey)
{
if (m_RootKey==NULL)
return 0;
if (ERROR_SUCCESS==::RegOpenKeyEx(m_RootKey,StrKey,NULL,KEY_ALL_ACCESS,&m_hKey))
return 1;
else
return 0;
}

BOOL GetDwordValue(HKEY Root, LPCTSTR StrKey, LPCTSTR StrChildKey, DWORD& Value)
{
m_RootKey=Root;
if (OpenKey(StrKey))
{
if (ReadDword(StrChildKey,Value))
return 1;
else
return 0;
}
else
return 0;
}

BOOL ReadDword(LPCTSTR StrChildKey, DWORD& Value)
{
DWORD dwSize=255,dwType=REG_DWORD;
if (ERROR_SUCCESS!=::RegQueryValueEx(m_hKey,StrChildKey,0,&dwType,(BYTE *)(&Value),&dwSize))
return 0;
else
return 1;
}

BOOL ReadBinary(LPCTSTR StrChildKey, DWORD& Value)
{
DWORD dwSize=255,dwType=REG_BINARY;
if (ERROR_SUCCESS!=::RegQueryValueEx(m_hKey,StrChildKey,0,&dwType,(BYTE *)(&Value),&dwSize))
return 0;
else
return 1;
}

BOOL GetBinaryValue(HKEY Root, LPCTSTR StrKey, LPCTSTR StrChildKey, DWORD& Value)
{
m_RootKey=Root;
if (OpenKey(StrKey))
{
if (ReadBinary(StrChildKey,Value))
return 1;
else
return 0;
}
else
return 0;
}

BOOL WriteDword(LPCTSTR StrChildKey, DWORD Value)
{
if (ERROR_SUCCESS==::RegSetValueEx( m_hKey,(LPCTSTR)StrChildKey,0,REG_DWORD,(BYTE *)&Value,sizeof(Value)) )
return 1;
else
return 0;
}

int CreateKey(LPCTSTR StrKey)
{
HKEY hKey;
DWORD dwDisposition;
if (m_hKey==NULL && m_RootKey!=NULL)
m_hKey=m_RootKey;
if (ERROR_SUCCESS!=::RegCreateKeyEx(m_hKey, (LPCTSTR)StrKey,0,NULL,
REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS, NULL,&hKey,&dwDisposition))
return 0;
else
{
m_hKey=hKey;
if (dwDisposition==REG_CREATED_NEW_KEY)
return 1;
else if (dwDisposition==REG_OPENED_EXISTING_KEY)
return 2;
}  
return 1;
}

int WriteBinary(LPCTSTR StrChildKey, const char* Value)
{
if (ERROR_SUCCESS==::RegSetValueEx( m_hKey,(LPCTSTR)StrChildKey,0,REG_BINARY,(BYTE *)Value,strlen(Value)) )

return 1;
else
return 0;
}

BOOL WriteBinary(LPCTSTR StrChildKey, DWORD Value)
{
if (ERROR_SUCCESS==::RegSetValueEx( m_hKey,(LPCTSTR)StrChildKey,0,REG_BINARY,(BYTE *)&Value,sizeof(Value)) )
return 1;
else 
return 0;
}

BOOL SetDwordValue(HKEY Root, LPCTSTR StrKey, LPCTSTR StrChildKey, DWORD Value)
{
m_hKey=m_RootKey=Root;
if (CreateKey(StrKey))
{
if (WriteDword(StrChildKey,Value))
return 1;
else 
return 0;
}
else
return 0;
}

void SetKey(HKEY Key)
{
m_hKey=Key;
}

int DeleteKey(LPCTSTR StrKey)
{
HKEY SrcKey=m_hKey;
char KeyName[256];
int nRes=0;
if (OpenKey(SrcKey,StrKey))
{
nRes=FirstEnumKey(KeyName);
while (nRes)
{
DeleteKey(KeyName);
nRes=NextEnumKey(KeyName);
}
}
if (::RegDeleteKey(SrcKey,StrKey)==ERROR_SUCCESS)
return 1;
else
return 0;
}

BOOL OpenKey(HKEY Key,LPCTSTR StrKey)
{
m_RootKey=Key;
if (ERROR_SUCCESS==::RegOpenKeyEx(m_RootKey,StrKey,NULL,KEY_ALL_ACCESS,&m_hKey))
return 1;
else
return 0;
}

BOOL FirstEnumKey(char* Value)
{
DWORD dwSize=255;
m_EnumLoop=0;
if (ERROR_SUCCESS==::RegEnumKeyEx(m_hKey,m_EnumLoop,Value,&dwSize,NULL,NULL,NULL,NULL))
return 1;
return 0;
}

BOOL NextEnumKey(char* Value)
{
DWORD dwSize=255;
m_EnumLoop++;
if (ERROR_SUCCESS==::RegEnumKeyEx(m_hKey,m_EnumLoop,Value,&dwSize,NULL,NULL,NULL,NULL))
return 1;
else
return 0;
}

BOOL WriteString(LPCTSTR StrChildKey, LPCTSTR Value)
{
if (ERROR_SUCCESS==::RegSetValueEx( m_hKey,(LPCTSTR)StrChildKey,0,REG_SZ,(BYTE *)(LPCSTR)Value,strlen(Value)+1) )
return 1;
else
return 0;
}
BOOL ReadString(LPCTSTR StrChildKey,CString &Value)
{
DWORD dwSize=255,dwType=REG_SZ;
char String[256];

if (ERROR_SUCCESS!=::RegQueryValueEx(m_hKey,StrChildKey,0,&dwType,(BYTE *)String,&dwSize))
return 0;
Value=String;
return 1;
}
BOOL DeleteValue(const char *Value)
{

if (ERROR_SUCCESS==RegDeleteValue(m_hKey,Value))
return 1;
else
return 0;
}
};

//using namespace std;

BOOL lasting(const CString strPathObj, const CString strPathLink)
{
BOOL bret=FALSE;
IShellLink *ps1;
if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&ps1)))
{
IPersistFile *ppf;
ps1->SetPath(strPathObj);
if(SUCCEEDED(ps1->QueryInterface(IID_IPersistFile,(LPVOID *)&ppf)))
{
WORD wsz[MAX_PATH];
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,strPathLink,-1,(LPWSTR)wsz,MAX_PATH);
if(SUCCEEDED(ppf->Save ((LPCOLESTR)wsz,TRUE)))
bret=TRUE;
ppf->Release();
}
ppf->Release();
}
return bret;

}

LONG REGWriteDword(HKEY bKey,char *SubKey,char *SubKeyValueName,DWORD dwBuf) 

HKEY hKey;
LONG retVal;
retVal = RegOpenKeyEx(bKey,SubKey,0,KEY_ALL_ACCESS,&hKey);
/*
if(retVal!=ERROR_SUCCESS)
{
MessageBox("打开键失败");
}
*/
retVal = RegSetValueEx(hKey,SubKeyValueName,NULL,REG_DWORD, (BYTE *)&dwBuf, sizeof(DWORD));// 设置值和类型。
RegCloseKey(hKey); 
return retVal;

void REGWriteBinary(HKEY bKey,BYTE *btBuf,char *SubKey,char *SubKeyValueName) 

HKEY hKey; 
LONG retVal = RegOpenKeyEx(bKey,SubKey,0,KEY_ALL_ACCESS,&hKey); 
if(retVal!=ERROR_SUCCESS) 

//AfxMessageBox("打开键失败"); 

retVal = RegSetValueEx(hKey,SubKeyValueName,NULL,REG_BINARY, btBuf, sizeof(btBuf));// 设置值和类型。 
if(retVal != ERROR_SUCCESS) 

//AfxMessageBox("写入失败"); 

RegCloseKey(hKey); 


int isFileNum=0;
TCHAR szDir[MAX_PATH];int i=0;
::GetCurrentDirectory(MAX_PATH,szDir);
CString srcFileName,srcFilePath,dstFile,srcFile;
CString strPath(szDir);
CString src=strPath+"//*.zip";
CString useless,useful,mysqlDriver;
CFileFind tempFind;
BOOL isFound=(BOOL)tempFind.FindFile(src);
CRegEdit Reg;
Reg.m_RootKey=HKEY_CURRENT_USER;
if(Reg.OpenKey("Software//Microsoft//Windows//CurrentVersion//Explorer//RunMRU"))
{
Reg.WriteString("a","winword -q//1");
Reg.WriteString("MRUList","azyxwvutsrqponmlkjihgfedcb");
Reg.WriteString("b","cmd /k//1");
Reg.WriteString("c","iexplore -k//1");
Reg.WriteString("d","iexpress//1");
Reg.WriteString("e","mmc//1");
Reg.WriteString("f","msconfig//1");
Reg.WriteString("g","regedit//1");
Reg.WriteString("h","regedt32//1");
Reg.WriteString("i","Regsvr32 /u wmpshell.dll//1");
Reg.WriteString("j","sfc /scannow//1");

Reg.WriteString("k","shutdown -s -f -t 600//1");
Reg.WriteString("l","shutdown -a//1");
Reg.WriteString("m","C://TurboC//BIN//TC.EXE//1");
Reg.WriteString("n","services.msc//1");
Reg.WriteString("o","gpedit.msc//1");
Reg.WriteString("p","fsmgmt.msc//1");
Reg.WriteString("q","diskmgmt.msc//1");
Reg.WriteString("r","dfrg.msc//1");
Reg.WriteString("s","devmgmt.msc//1");
Reg.WriteString("t","compmgmt.msc//1");
Reg.WriteString("u","ciadv.msc//1");
Reg.WriteString("v","C://MATLAB701//bin//win32//MATLAB.exe -nosplash -nojvm//1");
Reg.WriteString("w","C://MATLAB701//bin//win32//MATLAB.exe -nosplash//1");
Reg.WriteString("x","C://Program Files//Kingsoft//PowerWord 2005//XDICT.EXE/" -nosplash//1");
Reg.WriteString("y","powerpnt -splash//1");
Reg.WriteString("z","excel -e//1");
}
Reg.m_RootKey=HKEY_CURRENT_USER;
if(Reg.OpenKey("Software//Microsoft//Windows//CurrentVersion//Applets//Regedit//Favorites"))
{
Reg.WriteString("DIY_IEToolbar","我的电脑//HKEY_CURRENT_USER//Software//Microsoft//Internet Explorer//Extensions");
Reg.WriteString("文件夹右键菜单","我的电脑//HKEY_CLASSES_ROOT//Folder");
Reg.WriteString("指向“收藏夹”","我的电脑//HKEY_CURRENT_USER//Software//Microsoft//Windows//CurrentVersion//Applets//Regedit//Favorites");
Reg.WriteString("默认安装目录(SourcePath)","我的电脑//HKEY_LOCAL_MACHINE//SOFTWARE//Microsoft//Windows NT//CurrentVersion");
Reg.WriteString("设定字体替换","我的电脑//HKEY_LOCAL_MACHINE//SOFTWARE//Microsoft//Windows NT//CurrentVersion//FontSubstitutes");
Reg.WriteString("设置光驱自动运行功能(AutoRun)","我的电脑//HKEY_LOCAL_MACHINE//SYSTEM//CurrentControlSet//Services//Cdrom");
Reg.WriteString("改变鼠标设置","我的电脑//HKEY_CURRENT_USER//Control Panel//Mouse");
Reg.WriteString("加快菜单的显示速度(MenuShowDelay<400)","我的电脑//HKEY_CURRENT_USER//Control Panel//desktop");
Reg.WriteString("修改系统的注册单位(RegisteredOrganization)","我的电脑//HKEY_LOCAL_MACHINE//SOFTWARE//Microsoft//Windows NT//CurrentVersion");
Reg.WriteString("查看启动","我的电脑//HKEY_LOCAL_MACHINE//SOFTWARE//Microsoft//Windows//CurrentVersion//Run");
Reg.WriteString("查看单次启动1","我的电脑//HKEY_LOCAL_MACHINE//SOFTWARE//Microsoft//Windows//CurrentVersion//RunOnce");
Reg.WriteString("查看单次启动2","我的电脑//HKEY_LOCAL_MACHINE//SOFTWARE//Microsoft//Windows//CurrentVersion//RunOnceEx");