home *** CD-ROM | disk | FTP | other *** search
-
- Private Function RegDelete() As String
-
- Dim lonSubkeyHandle As Long
- Dim lonStatus As Long
-
- ' Use the GetSubkeyHandle function to determine the
- ' handle of the subkey given in txtSectionName.
- lonSubkeyHandle = GetSubkeyHandle(txtSectionName.Text)
- If lonSubkeyHandle = -1 Then
- ' Subkey could not be located.
- RegDelete = "Error - Subkey could not be located"
- Exit Function
- End If
-
- ' Use the RegDeleteKey API function to delete the
- ' key.
- lonStatus = RegDeleteValue(lonSubkeyHandle, _
- txtKeyName.Text)
- ' Check status of the operation.
- If lonStatus <> 0 Then
- RegDelete = "Error - Key could not be deleted"
- Else
- RegDelete = "Key deleted sucessfully"
- End If
-
- ' Close the open subkey with the CloseSubKey
- ' function.
- lonStatus = CloseSubkey(lonSubkeyHandle)
-
- End Function
-