Results 1 to 9 of 9

Thread: Registry Problem

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Registry Problem

    i used the registry functions provided below, the problem is when i write the registry it writes it but when i try to find it in the regedit it doesn't display it ? how come that be possible

    VB Code:
    1. Public Function Registry_Read(Key_Path, Key_Name) As Variant
    2.    
    3.     On Error Resume Next
    4.    
    5.     Dim Registry As Object
    6.    
    7.     Set Registry = CreateObject("WScript.Shell")
    8.    
    9.     Registry_Read = Registry.RegRead(Key_Path & Key_Name)
    10.    
    11. End Function
    12.  
    13.  
    14. Public Sub Registry_Write(Key_Path As String, Key_Name As String, Key_Value As Variant, Optional Key_Type As String)
    15.    
    16.     On Error Resume Next
    17.    
    18.     Dim Registry As Object
    19.    
    20.     Dim Registry_Value As Variant
    21.    
    22.     Set Registry = CreateObject("WScript.Shell")
    23.    
    24.     Registry_Value = Registry_Read(Key_Path, Key_Name)
    25.    
    26.  
    27.  
    28.     If Key_Type = "" Then
    29.        
    30.         'REG_SZ is the default.
    31.        
    32.         Registry.RegWrite Key_Path & Key_Name, Key_Value
    33.        
    34.     Else
    35.        
    36.         Registry.RegWrite Key_Path & Key_Name, Key_Value, Key_Type
    37.        
    38.     End If
    39.    
    40. End Sub
    Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water

    Huzefa Yousuf
    Software Engineer
    Verticity Inc.
    +92-345-2235303

    [email protected]

  2. #2
    Addicted Member BIOSTALL's Avatar
    Join Date
    Apr 2005
    Location
    Northampton, UK
    Posts
    180

    Re: Registry Problem

    Are you actually declaring where abouts in the registry u are writing to??

  3. #3

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Registry Problem

    yes i try to write the registry then read with the help of declared functions, it provides the accurate value but still it doesnt show in the regedit neither ne other application can access that registry
    Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water

    Huzefa Yousuf
    Software Engineer
    Verticity Inc.
    +92-345-2235303

    [email protected]

  4. #4
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Registry Problem

    Hey, isn't that my code from PSC?

  5. #5

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Registry Problem

    yeah it is ... but i can't get it to work... help me man !
    Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water

    Huzefa Yousuf
    Software Engineer
    Verticity Inc.
    +92-345-2235303

    [email protected]

  6. #6

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Registry Problem

    well if u guys can't solve this prb then tell me other ways to write registry
    Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water

    Huzefa Yousuf
    Software Engineer
    Verticity Inc.
    +92-345-2235303

    [email protected]

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Registry Problem

    This includes the module that does it:

    Enjoy
    Attached Files Attached Files

  8. #8
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Registry Problem

    I hope these helps....

    SaveSetting:
    VB Code:
    1. ' Place some settings in the registry.
    2. SaveSetting appname := "MyApp", section := "Startup", _
    3.             key := "Top", setting := 75
    4. SaveSetting "MyApp","Startup", "Left", 50
    5. ' Remove section and all its settings from registry.
    6. DeleteSetting "MyApp", "Startup"

    GetSetting:
    VB Code:
    1. Dim MySettings As Variant
    2. ' Place some settings in the registry.
    3. SaveSetting "MyApp","Startup", "Top", 75
    4. SaveSetting "MyApp","Startup", "Left", 50
    5.  
    6. Debug.Print GetSetting(appname := "MyApp", section := "Startup", _
    7.                        key := "Left", default := "25")
    8.  
    9. DeleteSetting "MyApp", "Startup

    SaveAllSetting:
    VB Code:
    1. ' Variant to hold 2-dimensional array returned by GetAllSettings
    2. ' Integer to hold counter.
    3. Dim MySettings As Variant, intSettings As Integer
    4. ' Place some settings in the registry.
    5. SaveSetting appname := "MyApp", section := "Startup", _
    6. key := "Top", setting := 75
    7. SaveSetting "MyApp","Startup", "Left", 50
    8. ' Retrieve the settings.
    9. MySettings = GetAllSettings(appname := "MyApp", section := "Startup")
    10.    For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
    11.       Debug.Print MySettings(intSettings, 0), MySettings(intSettings, 1)
    12.    Next intSettings
    13. DeleteSetting "MyApp", "Startup"

    DeleteSetting:
    VB Code:
    1. ' Place some settings in the registry.
    2. SaveSetting appname := "MyApp", section := "Startup", _
    3.             key := "Top", setting := 75
    4. SaveSetting "MyApp","Startup", "Left", 50
    5. ' Remove section and all its settings from registry.
    6. DeleteSetting "MyApp", "Startup"
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  9. #9
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Registry Problem

    And to read it:
    Attached Files Attached Files

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