Results 1 to 7 of 7

Thread: Deleting Program's Resistry settings...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    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?

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    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.

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Deleting Program's Resistry settings...

    Quote 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

  5. #5
    Addicted Member
    Join Date
    Jun 2006
    Posts
    172

    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.

  6. #6
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    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.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    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
  •  



Click Here to Expand Forum to Full Width