November 08, 2024, 04:25:54 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Windows Registry library file (Registry.lib)

Started by Andy, July 20, 2017, 06:19:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

July 20, 2017, 06:19:14 AM Last Edit: July 20, 2017, 06:26:58 AM by Andy
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.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.