IonicWind Software

Treasure Chest => Shared INC's and LIB's => Topic started by: Andy on July 20, 2017, 06:19:14 AM

Title: Windows Registry library file (Registry.lib)
Post by: Andy on July 20, 2017, 06:19:14 AM
Here I've turned the Registry.inc file into a library file because I've added two new functions:

RegDeleteAll

Example usage:
RegDeleteAll("HKEY_CURRENT_USER\\Software\\Test")

It deletes the registry key HKEY_CURRENT_USER\\Software\\Test and all of 'Test's" sub keys and values.

and

RegDeleteSubKeys

Example usage:
RegDeleteSubKeys("HKEY_CURRENT_USER\\Software\\Test")

Does the same as above except it leaves the key Test and it's values intact.

I've put some safe guards in place so you cannot (as far as I can see) delete a vital registry key - and that's why I have made it a lib file so it cannot be changed - no disrespect to anyone!

The lib file has all the same functions as the Registry.inc file. 
Included in the zip file are two examples:
DeleteAll - deletes the a key and sub keys.
Deletesubs - deletes all sub keys, but leaves the main key alone.

These two programs just create some harmless registry keys and sub keys.

How to:
Run each in turn
When the console screen tells you the keys have been created - minimise it
Go and open Regedit.exe.
Check the keys have been created.
Minimise Regedit.exe and press any key on the console screen so the program ends.
Now go back to Regedit.exe and you should see the Test key has been deleted (DeleteAll.iwb) and just the sub keys are gone (Deletesubs.iwb). - Make sure you press F5 to refresh Regedit.exe


As always, copy the lib file to your IWBDev\Libs folder, and the inc file to your IWBDev Include folder.

Thanks,
Andy.