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