Link to home
Get AccessLog in
Avatar of 66chawger
66chawgerFlag for United States of America

asked on

VB6 Runtime Issue on Windows 7 64bit

I have some older VB6 Code.  I installed the lastest patches for Windows 7 64bit, Visual Studio 6, etc.  

I turned UAC off, but that doesn't seem to be an issue anyway.   My initial problem was the get registry was looking in HKLM>Software>MyApp, which needs to be HKLM>Software>Wow6432Node>MyApp...

After making this change and testing through Visual Studio 6, the registry entry was found and all was well.  I then saved the project, compiled and created package.  Then Deployed package and after running from start menu I get the error I did before when the registry entry was in the wrong place.  I tried to run just the .exe by itself and same thing.   Went back to Visual Studio 6, and it runs fine.  Double-checked I saved code, compiled, built new package, uninstalled previous package, rebooted, installed new package and get same error coded in .bas module.  What gives???
Avatar of GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you tell us what the error is and what instruction is being executed?
is the installer 16-bit?
Avatar of 66chawger


Dim oReg As WinReg.Registry
    'Create a instance of the Registry object, assigned to oReg
    Set oReg = CreateObject("WinReg.Registry")
    'Get DB connection data
    sConnection = oReg.GetRegValue(WinReg.HKEY_LOCAL_MACHINE, "\Software\Wow6432Node\MyApp\MySubApp", "DB Connection")

Again, originally it was not looking in ..\Software\Wow6432Node...   I changed this, updated registry, works like a charm in VS6. Then when running as an exec it returns nothing for the registry key being read which makes the subsequent file transfer fail.

Installer is:  Windows Installer. V 5.0.7601.17514
In addition to my previous comment, I hardcoded the registry value entry in the program, and it worked fine as an executable.  So Win7 64bit does not like something about the get registry entry code I listed previously, although, again, it works fine inside Visual Studio 6.  This is a work around, but I really need to figure out why Win 7 64bit is barfing when running this VB6 code as an executable or installed.
I doubt the problem could be related to the way you access Registry using COM Object (WinReg.Registry). It might require your installed application to run as Administrator to use that COM Object.

If your application only reads the Registry (no creating/writing), then I would suggest using native Win32 API for manipulating Registry: With only Read access, it can work with standard users just fine.
Do you run Visual Studio 6 on the Windows 7 computer?

Microsoft supports applications created with VB6 (although many 3rd party do not work well starting in Vista), but does not support the VB6 IDE on Windows 7, thus the compiler.

I would try compiling the application on a previous version of Windows instead of Windows 7.
Avatar of 66chawger
Flag of United States of America image

Link to home
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
The inherent issues with MS and backward compatibility between 32 and 64 bit Windows 7 operating system is just not worth the effort in regards to registry retrieval, in this case withing VB6.  There are just better alternatives to this issue, in my case I chose to use a manifest.