Registry userlib to those who wants it!

Blitz3D Forums/Blitz3D Programming/Registry userlib to those who wants it!

ChrML(Posted 2004) [#1]
First, if you don't know what the registry is,
or it's purpose, press your browser's Back button.

Today I made a little userlibrary to those who wants it,
which gives Blitz possibilities to write and read to/from the registry.

Features:
Reg_ReadInt%( RootKey$, Path$, Name$)
Reg_ReadString$( RootKey$, Path$, Name$)
Reg_ReadFloat#( RootKey$, Path$, Name$)
Reg_WriteInt%( RootKey$, Path$, Name$, Data%)
Reg_WriteString%( RootKey$, Path$, Name$, Data$)
Reg_WriteFloat%( RootKey$, Path$, Name$, Data#)
Reg_WriteBinaryData%( RootKey$, Path$, Name$, BankSize%, Bank)
Reg_KeyExists%( RootKey$, Path$)
Reg_ValueExists%( RootKey$, Path$, Name$)
Reg_DeleteKey%( RootKey$, Path$)
Reg_DeleteValue%( RootKey$, Path$, Name$)


I would recommend that you backup your own registry if you're not familiar with programming in it before starting (however, I must admit that I have never backuped the registry. Not even when I made and tested this DLL).

Download it here (dll and .decls file)

If the link doesn't work, use _ttp://chrml.thefreebizhost.com/reg.zip (ofcourse you must replace "_" with "h").


Use it as you wish!

Usage:
Install: Put .dll, and .decls file into the /userlibs folder, and restart Blitz.

Parameters: Every "Rootkey$" parameter is the full name of the root ("HKEY_LOCAL_MACHINE", "HKEY_CURRENT_USER", and so on...). The "Path$" parameter is the path to the key (ie. "SOFTWARE\MyCompany\MyApplicationName"). The "Name$" parameter is always the name of a the value inside a key. Data is always what you want to write. About "Reg_WriteBinaryData", use the banks with care. The Bank parameter there is a Blitz bank created with CreateBank (a buffer as we call it). Remember to use a correct BankSize that is equals or is less than the size of the Bank (defined in CreateBank). Passing a bigger may cause unexpected results.

Return values: All commands return 1 (True) if success, or 0 (False) on failure.


Disclaimer: Reg.dll is bugfree (with 1.87 atleast), and if used properly it can't do any damage to the registry, however, that does not mean that the Blitz program that uses reg.dll can't damage it. If you find reg.dll in the same dir as a Blitz program that destroyed your Windows, then I'm not the person to be held responsible for that (as it's the Blitz programmer that uses the library that need to know what he shouldn't do to a users registry).


WendellM(Posted 2004) [#2]
Should be useful, thanks. I looked over registry functions this past weekend and wasn't too happy about having to do the weirdness required to access it. Then I saw that Inno Setup would do what I needed and just went with it. But for those times that a Blitz app needs to do it, these should be handy.


Picklesworth(Posted 2004) [#3]
I will probably not risk combining this with my stupidity, but I'm downloading anyway :)
Thanks.


VIP3R(Posted 2004) [#4]
Nice, thanks ChrML :)


ChrML(Posted 2004) [#5]
Thanks for nice comments :).


Rook Zimbabwe(Posted 2004) [#6]
ChrML this is a first class job. I am still trying to remember what I think I once know about Basic but 20 years and too many beers have made me unsteady. :)

Now I can register my program! Or check that it is registered!

Thanks
-Rook


Nikko(Posted 2004) [#7]
Thanks for this lib. I think that more tool developpers should use it, at least to save the current settings when you quit the application.
Now they have no excuses!


Braincell(Posted 2004) [#8]
Yea, this is great. Wow. I was just thinking about the possibilities of Blitz to write to the registry. Thank you!


simonh(Posted 2005) [#9]
Does anyone still have this? The link no longer works.


KuRiX(Posted 2005) [#10]
There is one in the code archives. I have it and it works perfectly!


BlackJumper(Posted 2005) [#11]
just emailed you a copy ;-}


simonh(Posted 2005) [#12]
Thanks :) I've uploaded it to this site so hopefully it won't disappear again.

See the toolbox entry for the download link.