Results 1 to 12 of 12

Thread: Merge a .reg File

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414

    Merge a .reg File

    Is there a way for a program to merge a .reg file (Regedit 4) without asking the user for confirmation?
    Thanks

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Open it using your VB prog, then transfer it into the registry?

  3. #3
    VB Code:
    1. Shell "regedit.exe somefile.reg /s". vbNormalFocus

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Well done dilbert, woops i mean ariel...

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414
    Thanks

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414

    To filburt1

    That works but it still asks for confirmation.

  7. #7
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    why not try my method?

  8. #8

    Re: To filburt1

    Originally posted by jdc6029
    That works but it still asks for confirmation.
    Weird, try this then:
    VB Code:
    1. Shell "regedit.exe /s somefile.reg". vbNormalFocus
    PassProg does this, just a sec while I check the code...

  9. #9
    Here's the code that does what I need with a .reg file...
    VB Code:
    1. Sub HideExtraButtonsOnFirstRun()
    2.  
    3.     Dim WindowsCommand As String, SystemCommand As String
    4.  
    5.     WindowsCommand = GetOSDirectory(WindowsDirectory) & "\regedit.exe"
    6.     SystemCommand = GetOSDirectory(SystemDirectory) & "\regedit.exe"
    7.    
    8.     If Dir(WindowsCommand) <> "" Then
    9.         AppStr WindowsCommand, " /s " & Chr(34) & App.Path & "\Default Toolbar Setup.reg" & Chr(34)
    10.         Shell WindowsCommand, vbMinimizedNoFocus
    11.         Exit Sub
    12.     Else
    13.         If Dir(SystemCommand) <> "" Then
    14.             AppStr WindowsCommand, " /s " & Chr(34) & App.Path & "\Default Toolbar Setup.reg" & Chr(34)
    15.             Shell SystemCommand, vbMinimizedNoFocus
    16.             Exit Sub
    17.         Else
    18.             MsgBox "Unable to apply toolbar registry patch: to remove extra buttons from the toolbar, " _
    19.                 & "right-click the toolbar and select Customize.", vbExclamation, "Error"
    20.         End If
    21.     End If
    22.    
    23. End Sub

  10. #10
    After reading that code it looks like Shell "regedit.exe /s somefile.reg". vbNormalFocus will work.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414

    Thanks

    Shell "regedit.exe /s somefile.reg", vbNormalFocus

    does work great. Now I just have to make it work with my ShellExecute function so it will work on Win2k also since the Shell command won't work with it, Thanks.

    The 'HideExtraButtonsOnFirstRun' is a good sub, thanks also.

    To da_silvy
    The reason I don't want to use a merge reg function is because my .reg file has over 100 entries and this will save me a lot of coding.

  12. #12
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    It wouldn't really be that much coding, but ariel's way is better

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