How do l found out all the Name, Type and Data under a
particular registry key inputted by user, I am using
VB6.0 and API Call. That the information show on the
right side of the windows when you open the "Regedit" .
Thanks!
To get the information which appears in RegEdit's right pane (value names
and data) use RegEnumValue(). You can wrap RegEnumValue() in a loop after
using RegQueryInfoKey() to determine the number of values, the maximum value
name length, and the maximum value data length.
--
- Vince
Thanks for help! Do you have any example or link that l
can take a look how to do it (l'm new in VB & API)
Peter C.
>.
>
> Hi Vincent,
>
> Thanks for help! Do you have any example or link that l
> can take a look how to do it (l'm new in VB & API)
Hi
Copy and paste this the following line into your IE address bar:
http://www.google.com/search?as_q=RegQueryInfoKey&as_sitesearch=microsoft.com
(it's a Google search for RegQueryInfoKey at the microsoft.com domain)
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>Thanks for help! Do you have any example or link that l
>can take a look how to do it (l'm new in VB & API)
I have no VB example. Basically, in "C", with no error control:
/* start */
HKEY hKey;
DWORD dwNumValues, dwMaxValueNameLen, dwMaxValueLen,
index, dwInitValueNameLen, dwInitValueLen;
LPSTR pszValueName;
LPBYTE pData;
/* open the registry key */
RegOpenKeyEx(HKEY_CURRENT_USER, "Environment", 0,
KEY_QUERY_VALUE, &hKey);
/* get info about what's in the key */
RegQueryInfoKey (hKey, NULL, NULL, NULL, NULL, NULL,
NULL, &dwNumValues, &dwMaxValueNameLen, &dwMaxValueLen, NULL, NULL);
/* allocate buffers that are big enough */
pszValueName = (LPSTR) malloc(1 + dwMaxValueNameLen);
pData = (LPBYTE) malloc(1 + dwMaxValueLen);
/* get the info in the registry key */
for (index = 0; index < dwNumValues; index++) {
dwInitValueNameLen = 1 + dwMaxValueNameLen;
dwInitValueLen = 1 + dwMaxValueLen;
RegEnumValue(hKey, index, pszValueName,
&dwInitValueNameLen, NULL, NULL, pData, &dwInitValueLen);
printf("%s=%s\n", pszValueName, pData);
}
/* clean up */
free(pszValueName);
free(pData);
RegCloseKey(hKey);
/* end */
Here, since the key "HKEY_CURRENT_USER\Environment" contains two values, the
example above produces the following output:
DESKTOP=e:\Users\vefatica\Desktop\
HOME=d:\home
--
- Vince
> Thanks for help! Do you have any example or link that l
> can take a look how to do it (l'm new in VB & API)
Hi
Copy and paste the following lines into your IE address bar (it's Google
*newsgroup* searches for RegQueryInfoKey and 20RegEnumValue in different VB
groups):