Accessing The Registration Database Via The API

In another article, Bradley S Murray detailed how to enter information into the Registration Database via a temporary file. While this method works, it does feel a little kludgy. I have written some demo code to show you how to add, query, amend and delete entries in the Registry via the API calls contained in SHELL.DLL

In the upcoming Windows 95, the Registry is used a lot more extensively than previously, with a good deal of the information that was once held in *.INI files now being stored in the Registry.

In addition, it is a good place to store information for your own programs, (within reason), as opposed to an *.ini file. There are certain rules for doing this, and as I understand it, they boil down to using either;

HKEY_LOCAL_MACHINE \ SOFTWARE \ CompanyName \ ProductName \ Version

or

HKEY_CURRENT_USER \ SOFTWARE \ CompanyName \ ProductName \ Version

Information in HKEY_LOCAL_MACHINE is specific to the local computer, whilst information about the configuration of the application is stored on a per-user basis under HKEY_CURRENT_USER.

Be aware that searching for the file REG.DAT will not work under Windows 95, as the file simply does not exist, so do not use this as a means of determining Registry availability.

For further reading on the Registration Database, I would suggest getting hold of Microsoft’s Technical Note “Configuration Management and the Registry”. This is an excellent help file, which tells you all you need to know about the Registry and is available at ftp://ftp.microsoft.com/developr/MSDN as REG.ZIP

 

Tip Submitted By: Stu Churchill

 


Discover more from dotNetTips.com

Subscribe to get the latest posts sent to your email.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.