Results 1 to 9 of 9

Thread: VB6 reading registry 32bit and 64bit

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2019
    Posts
    13

    VB6 reading registry 32bit and 64bit

    If anyone can send me in the right direction. It would be appreciate.
    I have a vb6 program that works fine in win10 32 bit but not in win10 64 bit. It gives me a runtime error when I call a subroutine to read registry values?

    Private Sub Registry()
    MsgBox " I am in sub registry this displays fine"
    Server_Name = regQuery_A_Key(HKEY_LOCAL_MACHINE, _ "SOFTWARE\CraneKemlite\Shared\System Connection", _
    "SERVER")

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Get a runtime error never prints my next msgbox'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Public Function regQuery_A_Key(ByVal lngRootKey As Long, _
    ByVal strRegKeyPath As String, _
    ByVal strRegSubKey As String) As Variant
    ' --------------------------------------------------------------
    ' ' Important: If you treat all key data strings as being case sensitive, you should never have a problem.
    ' Always backup your registry files (System.dat and User.dat) before performing any type of modifications
    '
    ' Description: Function for querying a sub key value.
    '
    ' Parameters:
    ' lngRootKey - HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_lOCAL_MACHINE, HKEY_USERS, etc
    ' strRegKeyPath - is name of the key path you wish to traverse.
    ' strRegSubKey - is the name of the key which will be queryed.
    '
    ' Syntax:
    ' strKeyQuery = regQuery_A_Key(HKEY_CURRENT_USER, _
    ' "Software\AAA-Registry Test\Products", _
    "StringTestData")
    '
    ' Returns the key value of "StringTestData"
    ' --------------------------------------------------------------
    ' --------------------------------------------------------------
    ' Define variables
    ' --------------------------------------------------------------
    Dim intPosition As Integer
    Dim lngKeyHandle As Long
    Dim lngDataType As Long
    Dim lngBufferSize As Long
    Dim lngBuffer As Long
    Dim strBuffer As String
    ' --------------------------------------------------------------
    ' Initialize variables
    ' --------------------------------------------------------------
    'CB2019
    MsgBox "I am in regQuery_A_Key"
    'CB2019
    MsgBox ("The value after is " & lngRootKey)
    MsgBox ("The value after is " & strRegKeyPath)
    MsgBox ("The value after is " & strRegSubKey)
    lngKeyHandle = 0
    lngBufferSize = 0

  2. #2
    Hyperactive Member
    Join Date
    Jan 2018
    Posts
    264

    Re: VB6 reading registry 32bit and 64bit

    HKLM\Software is redirected, not shared between 32-bit and 64-bit. So make sure that entry actually exists in the WOW64 area.

  3. #3
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: VB6 reading registry 32bit and 64bit

    Check the following post by dilettante:

    http://www.vbforums.com/showthread.p...=1#post3947938

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2019
    Posts
    13

    Re: VB6 reading registry 32bit and 64bit

    Thanks
    Would that be in the HKLM\SOFTWARE\WOW6432NODE?
    I added it there too. would I have to remove from the HKLM\SOFTWARE\ section for it to use the one in the WOW6432NODE one?
    Will I have to change the program to then look in the HKEY_LOCAL_MACHINE, _ "SOFTWARE\WOW6432NODE\CraneKemlite\Shared\System Connection
    or will it find it automatically? Right now this program is trying to be used on 32 bit and 64bit pc

    Also do I need to put this in wow6532node if the only thing in my registry is the Server name, and DB name.?
    Last edited by cbokoski; Nov 6th, 2019 at 02:12 PM.

  5. #5
    Addicted Member jj2007's Avatar
    Join Date
    Dec 2015
    Posts
    205

    Re: VB6 reading registry 32bit and 64bit

    It's a bit tricky to access the 64-bit registry from VB6 but not too diffult. Check this link to get more hints.

  6. #6
    Hyperactive Member
    Join Date
    Aug 2017
    Posts
    380

    Re: VB6 reading registry 32bit and 64bit

    This VBForums thread from the Google search above might enlighten you about Registry Redirection.

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2019
    Posts
    13

    Re: VB6 reading registry 32bit and 64bit

    Thanks,
    I got it working at least for one app so far.
    Last edited by cbokoski; Nov 7th, 2019 at 01:06 PM.

  8. #8

    Thread Starter
    New Member
    Join Date
    Oct 2019
    Posts
    13

    Re: VB6 reading registry 32bit and 64bit

    Thanks,
    I got it working at least for one app so far.

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 2019
    Posts
    13

    Cool Re: VB6 reading registry 32bit and 64bit

    Another program that was created with vb 6, I cannnot get to run in win10 64bit, it runs fine in win10 32 bit. and I even got to to run on 2 pcs running win10 64 bit, but when tried on the next 4 pcs. I get a run time error.

    I am fairly new here, so hope I have the information needed:
    I have an old program created with vb6 , I can use the program setup and install and run on win10 32 bit and everything installs and runs correctly.

    Trying to find out if there is any way to make it work on a 64 bit pc. When running the setup it hangs on "Installing Data Access Components" I went to task mgr and killed the MS setup tools(32bit)
    And then the application continued to install
    Ran the exe as administrator
    Application started, opened the user login window.
    That is where the application goes to the registry to look for user account permissions
    I have added these registry setting to the registry HKEY_current_user\software\wow6432node folder

    Application blew up with a run time error -2147220517,
    Any suggestions
    Attached Images Attached Images   

Tags for this Thread

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