I'm trying to make a command button that starts application that has it's
relative location written in registry (HKLM\SOFTWARE\Wow6432Node\...\DirIns,
DirIns being REG_SZ).
Well, I'm using XP64 but I don't see why would reading a registry key require admin rights
or be OS dependant (apart from addition of 'wow6432node' in 64bit OS).
Basically what I'm trying to read out from registry is the installation path written by setup
from a string value, which I'd then append in ShellExecute or Shell command - something
like:
whatimlookingfor = path as string
Shell("path\*.exe")
It should be.
Look at this page http://allapi.mentalis.org/apilist/r.shtml
Read the RegOpenKeyEx() and RegQueryValueEx() descriptions. Look at the sample how you read a registry key.
Another idea is to use the scripting host:
Code:
Dim wsh As Object
Dim Result as String
Set wsh = CreateObject("WScript.Shell")
Result = wsh.RegRead(KeyString)
KeyString must be the full registry path to the desired value.
If this is a valid file path you can Shell Result & "\filename.exe"
But David might be right with the administrative permissions. I'm not sure, I'm always administrator on my computers.
Last edited by WoF; January 29th, 2010 at 06:59 AM.
Bookmarks