2467.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 175 行

HTML
175
字号
<HTML>

<HEAD>

<META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">

<title>RegEnumValue</title>

<style type="text/css">

    body     { font-size: 80%; font-family: Verdana, Arial, Helvetica; }

    table    { font-size: 90%; font-family: Verdana, Arial, Helvetica; }

    h1       { font-weight: bold; font-size: 145%; }

    h2       { font-weight: bold; font-size: 125%; }

    h3       { font-weight: bold; font-size: 110%; }

    h4       { font-weight: bold; font-size: 100%; margin-top: 10pt; }

    h5       { font-weight: bold; font-size: 90%;  margin-top: 10pt; }

    big      { font-weight: bold; }

    code     { font-family: Lucida Sans Typewriter, Courier New, Courier; }

    pre      { font-family: Lucida Sans Typewriter, Courier New, Courier; font-size: 125%; }

    dt       { margin-top: 10pt; }

    li       { margin-top: 10pt; }

    img      { vertical-align: middle; }

    .indent1 { margin-left: 12pt; }

    .indent2 { margin-left: 24pt; }

    .indent3 { margin-left: 36pt; }

</style>

</HEAD>

<BODY BGCOLOR=#FFFFFF TEXT=#000000>

<font face="Verdana,Arial,Helvetica">

<form name=x><object name=iv classid="clsid:9c2ac687-ceef-11cf-96d9-00a0c903b016">

</object></form>

<h2>RegEnumValue</h2>

<p>

The <b>RegEnumValue</b> function enumerates the values for the specified open registry key. The function copies one indexed value name and data block for the key each time it is called. </p>

<pre><code><b>LONG RegEnumValue(

  HKEY</b><i> hKey</i><b>,              </b>// handle of key to query

<b>  DWORD</b><i> dwIndex</i><b>,          </b>// index of value to query

<b>  LPTSTR</b><i> lpValueName</i><b>,     </b>// address of buffer for value string

<b>  LPDWORD</b><i> lpcbValueName</i><b>,  </b>// address for size of value buffer

<b>  LPDWORD</b><i> lpReserved</i><b>,     </b>// reserved

<b>  LPDWORD</b><i> lpType</i><b>,         </b>// address of buffer for type code

<b>  LPBYTE</b><i> lpData</i><b>,          </b>// address of buffer for value data

<b>  LPDWORD</b><i> lpcbData</i>        // address for size of data buffer

<b>);</b>

 </code></pre>

<h5>Parameters</h5>

<dl>

<dt>

<i>hKey</i></dt>

<dd>

Identifies a currently open key or one of the following predefined reserved handle values: 

<p>

<b>HKEY_CLASSES_ROOT</b><br>

<b>HKEY_CURRENT_CONFIG</b><br>

<b>HKEY_CURRENT_USER</b><br>

<b>HKEY_LOCAL_MACHINE</b><br>

<b>HKEY_USERS<br>

Windows NT only:</b> <b>HKEY_PERFORMANCE_DATA</b> <br>

<b>Windows 95 only:</b> <b>HKEY_DYN_DATA</b> 



<p>

The enumerated values are associated with the key identified by <i>hKey</i>. 

</dd>

<dt>

<i>dwIndex</i></dt>

<dd>

Specifies the index of the value to retrieve. This parameter should be zero for the first call to the <b>RegEnumValue</b> function and then be incremented for subsequent calls. 

<p>

Because values are not ordered, any new value will have an arbitrary index. This means that the function may return values in any order. 

</dd>

<dt>

<i>lpValueName</i></dt>

<dd>

Pointer to a buffer that receives the name of the value, including the terminating null character. </dd>

<dt>

<i>lpcbValueName</i></dt>

<dd>

Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the <i>lpValueName</i> parameter. This size should include the terminating null character. When the function returns, the variable pointed to by <i>lpcbValueName</i> contains the number of characters stored in the buffer. The count returned does not include the terminating null character. </dd>

<dt>

<i>lpReserved</i></dt>

<dd>

Reserved; must be NULL. </dd>

<dt>

<i>lpType</i></dt>

<dd>

Pointer to a variable that receives the type code for the value entry. The type code can be one of the following values: 

<table cellspacing=5 cols=2>

<tr valign=top>

<th align=left width=228>Value</th>

<th align=left width=237>Meaning</th>

</tr>

<tr valign=top>

<td width=228>REG_BINARY</td>

<td width=237>Binary data in any form.</td>

</tr>

<tr valign=top>

<td width=228>REG_DWORD</td>

<td width=237>A 32-bit number.</td>

</tr>

<tr valign=top>

<td width=228>REG_DWORD_LITTLE_ENDIAN</td>

<td width=237>A 32-bit number in little-endian format. This is equivalent to REG_DWORD.<p>

In little-endian format, a multi-byte value is stored in memory from the lowest byte (the "little end") to the highest byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format.</p>

<p>

Windows NT and Windows 95 are designed to run on little-endian computer architectures. A user may connect to computers that have big-endian architectures, such as some UNIX systems. </p>

</td>

</tr>

<tr valign=top>

<td width=228>REG_DWORD_BIG_ENDIAN</td>

<td width=237>A 32-bit number in big-endian format. <p>

In big-endian format, a multi-byte value is stored in memory from the highest byte (the "big end") to the lowest byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format.</p>

</td>

</tr>

<tr valign=top>

<td width=228>REG_EXPAND_SZ</td>

<td width=237>A null-terminated string that contains unexpanded references to environment variables (for example, "%PATH%"). It will be a Unicode or ANSI string depending on whether you use the Unicode or ANSI functions.</td>

</tr>

<tr valign=top>

<td width=228>REG_LINK</td>

<td width=237>A Unicode symbolic link.</td>

</tr>

<tr valign=top>

<td width=228>REG_MULTI_SZ</td>

<td width=237>An array of null-terminated strings, terminated by two null characters.</td>

</tr>

<tr valign=top>

<td width=228>REG_NONE</td>

<td width=237>No defined value type.</td>

</tr>

<tr valign=top>

<td width=228>REG_RESOURCE_LIST</td>

<td width=237>A device-driver resource list.</td>

</tr>

<tr valign=top>

<td width=228>REG_SZ</td>

<td width=237>A null-terminated string. It will be a Unicode or ANSI string, depending on whether you use the Unicode or ANSI functions.</td>

</tr>

</table>

</dd>

</dl>

<p>

The <i>lpType</i> parameter can be NULL if the type code is not required. 

<dl>

<dt>

<i>lpData</i></dt>

<dd>

Pointer to a buffer that receives the data for the value entry. This parameter can be NULL if the data is not required. </dd>

<dt>

<i>lpcbData</i></dt>

<dd>

Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the <i>lpData</i> parameter. When the function returns, the variable pointed to by the <i>lpcbData</i> parameter contains the number of bytes stored in the buffer. This parameter can be NULL, only if <i>lpData</i> is NULL. </dd>

</dl>

<h5>Return Values</h5>

<p>

If the function succeeds, the return value is ERROR_SUCCESS.</p>

<p>

If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the <b>FormatMessage</b> function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.</p>

<h5>Remarks</h5>

<p>

To enumerate values, an application should initially call the <b>RegEnumValue</b> function with the <i>dwIndex</i> parameter set to zero. The application should then increment <i>dwIndex</i> and call the <b>RegEnumValue</b> function until there are no more values (until the function returns ERROR_NO_MORE_ITEMS). </p>

<p>

The application can also set <i>dwIndex</i> to the index of the last value on the first call to the function and decrement the index until the value with index 0 is enumerated. To retrieve the index of the last value, use the <b>RegQueryInfoKey</b> function. </p>

<p>

While using <b>RegEnumValue</b>, an application should not call any registration functions that might change the key being queried. </p>

<p>

The key identified by the <i>hKey</i> parameter must have been opened with KEY_QUERY_VALUE access. To open the key, use the <b>RegCreateKeyEx</b> or <b>RegOpenKeyEx</b> function. </p>

<p>

To determine the maximum size of the name and data buffers, use the <b>RegQueryInfoKey</b> function. </p>

<h5>QuickInfo</h5>

<p>

<b>&nbsp;&nbsp;Windows NT: </b>Use version 3.1 or later.<br>

<b>&nbsp;&nbsp;Windows: </b>Use Windows 95 or later.<br>

<b>&nbsp;&nbsp;Windows CE: </b>Use version 1.0 or later.<br>

<b>&nbsp;&nbsp;Header: </b>Declared in winreg.h.<br>

<b>&nbsp;&nbsp;Import Library: </b>Use advapi32.lib.</p>



</body>

</HTML>

⌨️ 快捷键说明

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