PRB: VB Registry Functions Are Limited with Nested SettingsLast reviewed: April 11, 1996Article ID: Q149038 |
The information in this article applies to:
SUMMARYThe SaveSetting statement and GetSetting function in Visual Basic 4.0 for Windows are used to create and retrieve information from nested levels in the Registry. However, the related DeleteSetting statement does not handle these nested settings. The GetAllSettings function also has this limitation.
SYMPTOMSError 5 - Invalid Procedure Call appears when the DeleteSetting is attempted.
STATUSThis behavior is by design. The ability to create and retrieve values from nested levels in the registry was a fortunate byproduct of the design of the set and get functions, and this wasn't extended to include all of the related registry functions.
WORKAROUNDUse more than one DeleteSetting statement to remove sections of the nested keys before removing the top level key, rather than attempting to remove the top key in isolation. For example, in the following, do not use:
DeleteSetting "Test1"Instead, use the following two lines of code to remove the Test1 key and its subkeys:
DeleteSetting "Test1\Test2" DeleteSetting "Test1"To enable all possible functionality, you can use the Registry API functions to perform any desired operation manually. For more information on the Registry API functions, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q145679 TITLE : How to Use the Registry API to Save and Retrieve Setting MORE INFORMATION
Steps to reproduce problem
|
KBCategory: kbprg
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |