Dimitrie O. Paun wrote:
On February 15, 2004 06:07 am, Zimler Attila wrote:
+BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath) +{ + BOOL result = FALSE; + LONG lRet; + HKEY hKey; + + lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_SET_VALUE, &hKey); + if (lRet != ERROR_SUCCESS) return FALSE; + + if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, keyPath) != IDYES) + goto done; + + lRet = RegDeleteKey(hKeyRoot, keyPath); + if (lRet != ERROR_SUCCESS) { + error(hwnd, IDS_BAD_KEY, keyPath); + goto done; + } + result = TRUE; + +done: + RegCloseKey(hKey); + return result; +}
Is RegDeleteKey() working to delete an entire tree? I haven't checked the documentation, but I thought we needed to use shell32.SHRegDeleteKey() instead...
I will check up for differences, but this deletes the entire key with subkeys and values from the marked key.