📄 registry_class.shtml.htm
字号:
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<meta NAME="Author" CONTENT="Zafir Anjum">
<title>Miscellaneous - Registry Entry Class</title>
</head>
<body background="../fancyhome/back.gif" tppabs="http://www.codeguru.com/fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink=
"#8E2323" alink="#FF0000" bgproperties="fixed">
<table WIDTH="100%">
<tr WIDTH="100%">
<td><td>
</tr>
</table>
<h3 align="center"><font color="#808080">Misc. MFC Topics - Registry Entry Class</font></h3>
<hr align="center">
<p>This tip was contributed by <a href="mailto:klen@bellatlantic.net">Ken C. Len</a>.</p>
<p>Here is another <a href="registry_calss.zip" tppabs="http://www.codeguru.com/misc/registry_calss.zip">class for handling the Registry</a>.<br>
<br>
I took this from the "Visual C++ 4.0 How-to" book and added new functionality.<br>
Functionalities added are keys enumeration and value enumerations.<br>
<br>
<br>
Here are some examples on using this class.</p>
<p> </p>
<pre><font COLOR="#990000"><tt>+++++++ Example 1 +++++++++
// normal read and write
CString strDefault;
CString strDriver;
CRegKey regKey;
if (regKey.Open(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Microsoft Access
Driver (*.mdb)") == ERROR_SUCCESS)
{
regKey.Read("", strDefault); // read default value
regKey.Read("Driver", strDriver);
regkey.Write("test", strDriver);
regKey.Close();
}</tt></pre>
</font>
<pre><font COLOR="#990000"><tt>
+++++++ Example 2 +++++++++
// enumerating keys
CStringArray strArray;
CRegKey regKey;
regKey.GetEnumKeys(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI",
strArray);
</tt></pre>
</font>
<pre><font COLOR="#990000"><tt>+++++++ Example 3 +++++++++
// enumerating values
CStringArray strArray;
CRegKey regKey;
regKey.GetEnumKeys(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC
Drivers", strArray);</tt></pre>
</font>
<p><tt><font COLOR="#990000"><br>
</font></tt>Posted on: 4/2/98 </p>
<hr>
<table BORDER="0" WIDTH="100%">
<tr>
<td WIDTH="33%"><font SIZE="-1"><a HREF="../index.htm" tppabs="http://www.codeguru.com/">Goto HomePage</a></font></td>
<td WIDTH="33%"><p align="center"><font SIZE="-2">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -