rmRegistry.cc  
  A Custom Control for manipulating the Windows registry
 


A sample Registry.prg shipped with the first 32bit version of dBASE, Visual dBASE 7.0. While this was very useful, it had one major drawback in that if you tried to open a registry key that did not already exist, it was created for you. There was no way to check for the existence of a key before you started.

Only as recently as 2005 was this fundamental problem tackled by Tilman Rötger, and then some work was done by Michael Nuwer to turn this into a custom class.

This custom control builds on the work already done, and is a complete restructuring of the original code. Various typos and minor bugs have been corrected along the way, and everything is now coded to work in an OO way. There has been extensive renaming of properties variables etc. for clarity and ease of comprehension.

  • Automatic read-only methods are now used unless required for creation, editing or deleting.
  • The need for an Init method has been removed.
  • There is a new SetMainKey() method with Boolean return of success.
  • There is a new SetSubKey() method with Boolean return of success.
  • Most importantly, there is a new CreateKey() method with Boolean return of success. CreateKey() is designed to fail and return false if the Key already exists.
  • The DeleteKey() method has been rewritten to give a Boolean return of success.
  • Header files have been corrected, added to, and moved into the cc to remove any outside file dependency.
  • GetValue() has been rewritten to deal with all data types in one function, and now returns the value, or if this fails, returns false.
  • DeleteValue() rewritten to give a Boolean return of success.
  • GetValueNameList() returns an array, or now returns false if it fails.
  • New GetSubKeyList() method returns an array, or false if it fails.

See rmRegistryTest.wfm for sample usage and code.