;
; Recursive registry delete routine, to be compatible with all windows versions
;
Procedure RegDeleteKeysRecursive(StartKey, pKeyName$)
Result = ~#ERROR_SUCCESS
If pKeyName$
Result = RegOpenKeyEx_(StartKey, pKeyName$, 0, #KEY_ENUMERATE_SUB_KEYS | #DELETE, @Key )
If Result = #ERROR_SUCCESS
SubKeyName$ = Space(512)
While Result = #ERROR_SUCCESS And Quit = 0
SubKeyLength = 512
Result = RegEnumKeyEx_(Key, SubKeyIndex, SubKeyName$, @SubKeyLength, 0, 0, 0, 0)
SubKeyIndex+1
If Result = #ERROR_NO_MORE_ITEMS
Result = RegDeleteKey_(StartKey, pKeyName$)
Quit = 1
ElseIf Result = #ERROR_SUCCESS
SubKeyIndex-1
If RegDeleteKeysRecursive(Key, SubKeyName$)
Result = #ERROR_SUCCESS;
EndIf
EndIf
Wend
RegCloseKey_(Key)
EndIf
EndIf
If Result = #ERROR_SUCCESS
ProcedureReturn 1
Else
ProcedureReturn 0
EndIf
EndProcedure
; Test here... WARNING, it could be dangerous !
;
RegDeleteKeysRecursive(#HKEY_CURRENT_USER, "Software\YourFavoriteSoftwareHere")
sec wrote:
why don't support "API in SHLWAPI.DLL"?
EDIT: dlls usually used is better (as Fred did)
Because of this:
Minimum DLL Version shlwapi.dll version 4.71 or later
Custom Implementation No
Header shlwapi.h
Import library shlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0