⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 234-236.html

📁 WindowsCE.[Essential Windows CE Application Programming].Jon Wiley & Son.zip
💻 HTML
📖 第 1 页 / 共 2 页
字号:
			<option value="/reference/dir.webmasterskills1.html">Webmaster
			<option value="/reference/dir.y2k1.html">Y2K
			<option value="">-----------
			<option value="/reference/whatsnew.html">New Titles
			<option value="">-----------
			<option value="/reference/dir.archive1.html">Free Archive		
			</SELECT>
			</font></td>
	</tr>
	</table>
	</form>
<!-- LEFT NAV SEARCH END -->

		</td>
		
<!-- PUB PARTNERS END -->
<!-- END LEFT NAV -->

<td rowspan="8" align="right" valign="top"><img src="/images/iswbls.gif" width=1 height=400 alt="" border="0"></td>
<td><img src="/images/white.gif" width="5" height="1" alt="" border="0"></td>
<!-- end of ITK left NAV -->

<!-- begin main content -->
<td width="100%" valign="top" align="left">


<!-- END SUB HEADER -->

<!--Begin Content Column -->

<FONT FACE="Arial,Helvetica" SIZE="-1">
To access the contents, click the chapter and section titles.
</FONT>
<P>
<B>Essential Windows CE Application Programming</B>
<FONT SIZE="-1">
<BR>
<I>(Publisher: John Wiley & Sons, Inc.)</I>
<BR>
Author(s): Robert Burdick
<BR>
ISBN: 0471327476
<BR>
Publication Date: 03/01/99
</FONT>
<P>
<form name="Search" method="GET" action="http://search.earthweb.com/search97/search_redir.cgi">

<INPUT TYPE="hidden" NAME="Action" VALUE="Search">
<INPUT TYPE="hidden" NAME="SearchPage" VALUE="http://search.earthweb.com/search97/samples/forms/srchdemo.htm">
<INPUT TYPE="hidden" NAME="Collection" VALUE="ITK">
<INPUT TYPE="hidden" NAME="ResultTemplate" VALUE="itk-simple-intrabook.hts">
<INPUT TYPE="hidden" NAME="ViewTemplate" VALUE="view.hts">

<font face="arial, helvetica" size=2><b>Search this book:</b></font><br>
<INPUT NAME="queryText" size=50 VALUE="">&nbsp;<input type="submit" name="submitbutton" value="Go!">
<INPUT type=hidden NAME="section_on" VALUE="on">
<INPUT type=hidden NAME="section" VALUE="http://www.itknowledge.com/reference/standard/0471327476/">

</form>


<!-- Empty Reference Subhead -->

<!--ISBN=0471327476//-->
<!--TITLE=Essential Windows CE Application Programming//-->
<!--AUTHOR=Robert Burdick//-->
<!--PUBLISHER=John Wiley & Sons, Inc.//-->
<!--IMPRINT=Wiley Computer Publishing//-->
<!--CHAPTER=8//-->
<!--PAGES=234-236//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="231-234.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="236-238.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B>The <I>RegQueryInfoKey</I> Function
</B></FONT></P>
<P>There is one more registry function related to reading information about registry keys. Whereas <I>RegQueryValueEx</I> reads the actual value data from a specified registry key value, <I>RegQueryInfoKey</I> allows your application to determine the number of subkeys and values that a particular registry key contains. This becomes important when you need to iterate over a set of subkeys or values, which is the subject of the next section.</P>
<P><I>RegQueryInfoKey</I> also does other work for you, such as determining the class name of the particular key and the length of that class name, as well as the maximum subkey, class, and value name lengths of all subkeys and values associated with the queried key.</P>
<P>The syntax of <I>RegQueryInfoKey</I> is:</P>
<!-- CODE SNIP //-->
<PRE>
  RegQueryInfoKey(hKey, lpClass, lpcbClass, lpReserved,
    lpcSubkeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues,
     lpcbMaxValueNameLen, lpcbMaxValueData,
      lpcbSecurityDescriptor, lpftLastWriteTime);
</PRE>
<!-- END CODE SNIP //-->
<P><I>hKey</I> is the HKEY of the key to be queried. <I>lpClass</I> is a Unicode string buffer used by the function to return the class of <I>hKey</I>. This parameter can be NULL if your application is not interested in class name information. <I>lpcbClass</I> is a DWORD pointer used to return the length of the string returned in <I>lpClass</I>. <I>lpcbClass</I> should be NULL if <I>lpClass</I> is NULL. <I>lpReserved</I> is reserved and should be NULL.</P>
<P>The next parameter is <I>lpcSubkeys</I>. This is a DWORD pointer in which <I>RegQueryInfoKey</I> returns the number of subkeys contained by <I>hKey</I>. This parameter can be NULL if this information is not of interest. <I>lpcbMaxSubKeyLen</I> returns the length in characters of the longest subkey name. For some mysterious reason, this count does <I>not</I> include the null-terminating character. Compare this with the <I>lpcbData</I> parameter of <I>RegQueryValueEx</I>, which does include the null-terminator in cases where it is used to read string values from the registry.</P>
<P><I>lpcbMaxClassLen</I> returns the length of the longest class name of any of the subkeys contained by <I>hKey</I>. No null-terminator here, either. Both <I>lpcbMaxSubKeyLen</I> and <I>lpcbMaxClassLen</I> can be NULL.</P>
<P><I>lpcValues</I> returns the number of values contained by the queried key. This can be NULL if you are not interested in this information. <I>lpcbMaxValueNameLen</I> returns the length of the longest value name string. This parameter can be NULL, and again, does not include the null-terminator in its string character length count.</P>
<P><I>lpcbMaxValueData</I> and <I>lpcbSecurityDescriptor</I> are not used. They should therefore be set to NULL.</P>
<P>Finally, <I>lpftlastWriteTime</I> is not used and can be NULL. Under Windows NT, this parameter could be used to determine the last time a key or any of its values were changed. Windows CE, however, does not provide this feature.</P>
<P>A typical use of <I>RegQueryInfoKey</I> is to determine the number of subkeys and values contained by a particular registry key. To continue our example of the HKEY_LOCAL_MACHINE\Test key, let&#146;s write the code necessary to find the number of subkeys and values in this key:</P>
<!-- CODE SNIP //-->
<PRE>
  HKEY hKeyTest;
  DWORD dwSubKeys, dwValues;
  RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Test"),
    0, 0, &#38;hKeyTest);
  RegQueryInfoKey(hKeyTest, NULL, NULL, NULL,
    &#38;dwSubKeys, NULL, NULL, &#38;dwValues, NULL,
    NULL, NULL, NULL);
</PRE>
<!-- END CODE SNIP //-->
<P>We first open the HKEY_LOCAL_MACHINE\Test registry key. The <I>RegQueryInfoKey</I> call then gets the number of subkeys in <I>dwSubKeys</I>, and the number of values in <I>dwValues</I>.</P>
<P>Notice all of the NULL parameter values. In this example we are not interested in the class names, class name lengths, value name lengths, and the other sundry things that this function can return. Therefore, the parameters corresponding to these pieces of information are all NULL.</P>
<P>Now that our applications can get subkey and value counts, they have all the information they need to iterate over subkeys and values, reading or writing data as needed. All we need to do is introduce the registry enumeration functions.</P>
<H3><A NAME="Heading5"></A><FONT COLOR="#000077">Enumerating Registry Keys and Values</FONT></H3>
<P><I>Enumeration</I> is the process of iterating over a set of registry keys or values and extracting information about each one as it is iterated.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="231-234.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="236-238.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>


<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->

<!-- BEGIN SUB FOOTER -->
		<br><br>
		</TD>
    </TR>
	</TABLE>

		
	<table width="640" border=0 cellpadding=0 cellspacing=0>
		<tr>
		<td align="left" width=135><img src="/images/white.gif" width=100 height="1" alt="" border="0"></td>
		
		
<!-- END SUB FOOTER -->

<!-- all of the books have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->

<!-- FOOTER -->
			
		<td width="515" align="left" bgcolor="#FFFFFF">
<font face="arial, helvetica" size="1"><b><a href="/products.html"><font color="#006666">Products</font></a>&nbsp;|&nbsp; <a href="/contactus.html"><font color="#006666">Contact Us</font></a>&nbsp;|&nbsp; <a href="/aboutus.html"><font color="#006666">About Us</font></a>&nbsp;|&nbsp; <a href="http://www.earthweb.com/corporate/privacy.html" target="_blank"><font color="#006666">Privacy</font></a> &nbsp;|&nbsp; <a href="http://www.itmarketer.com/" target="_blank"><font color="#006666">Ad Info</font></a> &nbsp;|&nbsp; <a href="/"><font color="#006666">Home</font></a></b>
		<br><br>
		
		Use of this site is subject to certain <a href="/agreement.html">Terms &amp; Conditions</a>, <a href="/copyright.html">Copyright &copy; 1996-1999 EarthWeb Inc.</a><br> 
All rights reserved.  Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.</font><p>
</td>
		</tr>
</table>
</BODY>
</HTML>

<!-- END FOOTER -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -