Reading the Registry from a (VB) COM dll
Posted on 2001-07-03
I am tring to read the Registry from a COM dll and having some problems.
The idea is as follows...
When I want to read a user defined registry variable I put the following line of code in my vb com dll.
myvar = GetSetting(appname:="myappname", section:="mysection", key:="myvarname", Default:="failure")
This key is located in HKCU/software/VB and VBA program settings/myappname/mysection/....
The package the dll is loaded into runs under the user (Identity tab in Package properties) which has the registry key set.
This works for me most of the time - However, the read from the registry fails after a server reboot. The actual read from GetSetting fails, I don't even get the "Default" string. At that stage I have to do all sorts of thigs to get it working again.
Deleting the package and re-setting up sometimes works. But as you can imagine this is not really good enough.
Has anybody seen this problem before and can offer advice or a solution?
I dont want to have to resort to ini files or hard coded variables. The registry is a good solution (when it works!)
PS I Hope my question is clear - I hate unclear questions!