I have a dll(written in vb6) that compiles VB6 code.
I'm reading the VB6.exe path from the registry and it works fine.
m_oRegTool.RegistryPath = "Applications\vb6.exe\shell\make\command"
sVB6EXEFile = m_oRegTool.GetValueData("", "")
The problem is that the VB6.exe path is located in different locations in the registry for XP and win 7 (64 bit).
Any ideas how I can find the VB6.exe in the registry without specifying the location in the registry?
I think that (in a standard install and if the user hasn't changed the default) that the following registry key will contain the path the the exe:
The Default value in this key contains the open command for
vbp files - On my machine:
"C:\Program Files (x86)\Microsoft Visual Studio\VB98\vb6.exe" "%1"
So you could just remove the "%1" and the other double quotes to get your path
You can get the VB6 installation folder from the registry value written by the installer:
HKLM\SOFTWARE\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual Basic\ProductDir
On my machine, this value is
C:\Program Files\Microsoft Visual Studio\VB98
There is sample (C#) code that gets this path in my BuilderPro project.
I'm not sure why you are messing with the Shell's registry entries anyway.
You should be able to use Shell32's COM interface or standard-export entrypoints to invoke the "make" verb against an appropriate file (generally a .VBP). Either navigate to the .VBP's Shell Folderitem and call the InvokeVerb method on it or call ShellExecute/Ex passing the file path and the "make" verb.
No registry spelunking required, and you're using documented APIs!