当前位置: 动力学知识库 > 问答 > 编程问答 >

How to find registry value without knowing the registry path vb6?

问题描述:

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?

thanks,

网友答案:

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:

HKEY_CLASSES_ROOT\VisualBasic.Project\shell\open\command

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!

分享给朋友:
您可能感兴趣的文章:
随机阅读: