Ok updated some stuff:
PHP Code:
void q(HKEY hk, const char *k, HWND hTest, const int pref)
{
char szBuffer[MAX_KEY_LENGTH];
HKEY hKey;
RegOpenKeyEx(hk,k,0,KEY_ALL_ACCESS,&hKey);
DWORD cSubKeys;
DWORD maxSubkeyLen;
DWORD retCode;
RegQueryInfoKey(hKey, NULL, NULL, NULL, &cSubKeys, &maxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
if(cSubKeys>0)
{
static char currentSubkey[MAX_PATH];
int i;
for(i=0;i < cSubKeys;i++)
{
DWORD currentSubLen=MAX_PATH;
retCode=RegEnumKeyEx(hKey, i, currentSubkey, ¤tSubLen, NULL, NULL, NULL, NULL);
if(retCode==ERROR_SUCCESS)
{
char l[3 * MAX_KEY_LENGTH];
static char p[sizeof(prefix)];
snprintf(p, MIN(pref, sizeof(p)), "%s", prefix);
snprintf(l, sizeof(l), "%s\\%s", k, currentSubkey);
_stprintf_s(szBuffer, "%s%s\n", p, l);
SetWindowText(hTest, szBuffer);
q(hk, l, hTest, pref + 2);
}
}
}
RegCloseKey(hKey);
}
I call it by passing this:
PHP Code:
q(HKEY_CURRENT_USER, "Software\\Shoreline Teleworks", hTabView2, 0);
Now this key has a bunch of sub categories under it (about 5), but when I print out the result it only prints the last one. Why???
Here is the whole function:
PHP Code:
void CreateStaticViewTab2()
{
RECT tr = {0}; // rect structure to hold tab size
// get the tab size info so we can place the view window in the right place
TabCtrl_GetItemRect(hTab, 1, &tr);
hTabView2 = CreateWindowEx(0, TEXT("STATIC"), TEXT(""), WS_CHILD | WS_VISIBLE | SS_LEFT, 200, 200, 600, 400, hTab, NULL, hInst, NULL);
q(HKEY_CURRENT_USER, "Software\\Shoreline Teleworks", hTabView2, 0);
CenterWindow(hTabView2, hWnd, 500, 300);
}