Education / TutorialsMiscellaneousProgramming Solutions → Using registries in delphi by JM-DG

12 Jul 2009, 02:40

Download

I got a request from TDU today. He wanted to access to windows registry, but didn't know how to by programming using delphi.

So basically this code will show you how to associate/desassociate an extension with the icon of your application.



If you wan to use it for other purposes this is basically always the same structure:

need to use the TRegistry of delphi.
Create your class. TRegistry.Create;
what is the root key of where you want to search in the registry: reg.RootKey := HKEY_CLASSES_ROOT;

now you may do what you want:
reg.KeyExists: Tests the existence of the key.
reg.OpenKey: Opens a key to access some values within.
reg.WriteString: Write the string you want to write.
there are others too... Names are pretty much straight foward... :)
RegCreateKey()
RegDeleteKey()
RegEnumKey()
RegQueryValue()
RegSetValue()

reg.CloseKey: At the end always close the key you just opened.
reg.Free; Free the class created.

This is a tutorial from Developers Heaven team.
Join to share your knowledge and have fun...

Keywords registry, tutorial, JM-DG, delphi, read registry, write registry Rating 7 Comments 0
Reply

You have to login or register to post comments.

JM-DG
JM-DG
91 ♠ 211 ♣