CRegKey EnumKey is a function that enumerates subkeys of a given registry key. It takes in the following parameters:
1. hKey: A handle to an open registry key specified as HKEY.
2. dwIndex: The index of the subkey to retrieve.
3. lpName: A pointer to a buffer that receives the name of the subkey.
4. lpcName: A pointer to a variable that specifies the size of the buffer pointed to by lpName.
5. lpClass: A pointer to a buffer that receives the class string of the specified subkey.
6. lpcClass: A pointer to a variable that specifies the size of the buffer pointed to by lpClass.
7. lpftLastWriteTime: A pointer to a FILETIME structure that receives the last write time of the specified subkey.
Code Example:
HKEY hKey; DWORD i = 0; LSTATUS res; TCHAR name[1000]; DWORD cchName = 1000; while (1) { res = RegEnumKeyEx(hKey, i, name, &cchName, NULL, NULL, NULL, NULL); if (res == ERROR_SUCCESS) { // Do something with the subkey } else if (res == ERROR_NO_MORE_ITEMS) { // No more subkeys break; } else { // Error } cchName = 1000; i++; }
This code example demonstrates how to use the EnumKey function to enumerate all subkeys of a given registry key. It uses the RegEnumKeyEx function to retrieve subkey names and checks for the ERROR_NO_MORE_ITEMS status to know when to stop enumeration.
Package Library:
The CRegKey EnumKey function is part of the Microsoft Windows API, which means it is included in the Windows SDK and can be used in C++ projects targeting the Windows operating system.
C++ (Cpp) CRegKey::EnumKey - 20 examples found. These are the top rated real world C++ (Cpp) examples of CRegKey::EnumKey extracted from open source projects. You can rate examples to help us improve the quality of examples.