add .reg file inside VB6
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: add .reg file inside VB6

  1. #1
    Join Date
    Oct 2012
    Posts
    13

    add .reg file inside VB6

    I want to add a .reg file into Registry by inside VB6 , I don't want :

    Shell ("regedit /s C:\xxx.reg)

    As sometimes it works in Win8 by not in Win7 , or vise versa. The .reg file is a bit long , so I don't know how to write them in VB6 :

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList]
    "Default"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,44,00,72,00,69,00,\
    76,00,65,00,25,00,5c,00,55,00,73,00,65,00,72,00,5c,00,44,00,65,00,66,00,61,\
    00,75,00,6c,00,74,00,00,00
    "ProfilesDirectory"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,44,00,72,\
    00,69,00,76,00,65,00,25,00,5c,00,55,00,73,00,65,00,72,00,00,00
    "Public"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,44,00,72,00,69,00,76,\
    00,65,00,25,00,5c,00,55,00,73,00,65,00,72,00,5c,00,50,00,75,00,62,00,6c,00,\.
    69,00,63,00,00,00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-3696591734-2486099824-1420648632-1001]
    "ProfileImagePath"=hex(2):43,00,3a,00,5c,00,55,00,73,00,65,00,72,00,5c,00,50,\
    00,43,00,00,00

    Please help. Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,999

    Re: add .reg file inside VB6

    Explain WHAT you are trying to do.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Oct 2012
    Posts
    13

    Re: add .reg file inside VB6

    This is just an example , as some .reg file is quite long and in different location like above.
    Instead of generate a .reg file and and use
    Shell ("regedit /s C:\xxx.reg)
    I want to run the contents of the xxx.reg from inside VB6 like :

    CreateObject("WScript.Shell").RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\CleanRubbish", "Clean.exe"

    If the xxx.reg is very long , how can I do it like above in VB6

  4. #4
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,853

    Re: add .reg file inside VB6

    You could use a variable instead of putting the literal text on that line.

    Of course I would not use the Wscript object at all but it should do,
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center