|
-
Jun 19th, 2007, 05:23 AM
#1
Thread Starter
Fanatic Member
Deleting Program's Resistry settings...
SaveSetting "Program Name", "Setting", "Option", Value
How can i delete everything from just knowing the "Program Name", like delete all the settings?
-
Jun 19th, 2007, 05:37 AM
#2
Re: Deleting Program's Resistry settings...
Hai,
The following example delete "My Program" key and all the its values and data.
Code:
Public Sub delUrlKey()
regkey = "Software"
lngresult = RegOpenKeyEx(HKEY_CURRENT_USER, regkey, 0&, keyallaccess, path)
If lngresult = 0 Then
lngresult = RegDeleteKey(path, "My Program")
RegCloseKey (path)
End If
End Sub
If you have subkeys under the main key, then you will have to remove it first as i remember.
Last edited by Fazi; Jun 19th, 2007 at 05:46 AM.
-
Jun 19th, 2007, 06:34 AM
#3
Re: Deleting Program's Resistry settings...
use deletesetting
DeleteSetting Statement
Deletes a section or key setting from an application's entry in the Windowsregistry.
Syntax
DeleteSetting appname, section[, key]
The DeleteSetting statement syntax has thesenamed arguments:
Part Description
appname Required.String expression containing the name of the application orproject to which the section or key setting applies.
section Required. String expression containing the name of the section where the key setting is being deleted. If only appname and section are provided, the specified section is deleted along with all related key settings.
key Optional. String expression containing the name of the key setting being deleted.
Remarks
If allarguments are provided, the specified setting is deleted. A run-time error occurs if you attempt to use the DeleteSetting statement on a non-existent section or key setting.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 19th, 2007, 12:29 PM
#4
Re: Deleting Program's Resistry settings...
 Originally Posted by Slyke
SaveSetting "Program Name", "Setting", "Option", Value
How can i delete everything from just knowing the "Program Name", like delete all the settings?
If this is from your own program, or a program for which you know the appname and section, DeleteSetting will work. A lot of programs make an entry somewhere having noting to do with themselves, but keeping a record of installation date, so you can't run the program after the trial period expires, and you can't find the registry entry by the name of the program.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jun 19th, 2007, 12:42 PM
#5
Addicted Member
Re: Deleting Program's Resistry settings...
Also remember, SaveSetting and GetSetting will default to a specific location in the registry.
HKEY_CURRENT_USER\Software\VB and VBA Program Settings
So if you want to save it in LOCAL_MACHINE for example, you'd have to use another method.
- If you found my post to be helpful, please rate me.

-
Jun 19th, 2007, 12:59 PM
#6
Re: Deleting Program's Resistry settings...
My 2p worth. To delete a subkey and all contents including subkeys with no fuss, use the SHDeleteKey API.
-
Jun 20th, 2007, 12:53 AM
#7
Thread Starter
Fanatic Member
Re: Deleting Program's Resistry settings...
Lol, i wasnt trying to crack programs, just wanted to do a "reset all options" for programs i made XD. I know they would'nt store trial periods in the same place as settings!
But thanks for the answers =D.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|