Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String not setting to variable correctly??

Status
Not open for further replies.

LuckyDuck528

Programmer
Dec 21, 2004
65
US
Hello,

First off if there is a better place for this question like maybe in the winserver 2003 forum let me know...

I'm trying to run my .exe and somethings not working right.. I'believe I've narrowed the problem down to this: I'm trying to use the regobj.dll so that I don't have to use the windows API, not becasue I don't want to but because that would require rewriting this program that I didn't create but rather am just modifying to go from an NT box to Server2003.

So i have this line of code that reads:
Code:
Set objRemoteRegistry = RemoteRegistry(strServerName)
Set objRegRootKey = objRemoteRegistry.RegKeyFromString("\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" &  Services.strName(intServiceCount) & "\Parameters")


'debugging line
Open strLogFile For Append As #20
   Print #20, objRegRootKey
Close

Normally I would expect the value of objRegRootKey to be HKEY_LOCAL_MACHINE\SYSTEM\etc...

instead, my output says that the value is only the word "Parameters"

Any ideas on what might be going wrong and I how could fix it?


Thank you in advance for your time. Your help is greatly appreciated!

sincerly,
LuckyDuck
 
I'm not familiar with the regobj.dll but, from looking at your code, it appears that the .RegKeyFromString() method returns an object... probably of type RegKey.

Why do you assume that it returns a string?
 
When you do something like this with an object
Code:
Print #20, objRegRootKey
The system is probably assuming some default property to be printed and that may not be the one that contains HKEY_LOCAL_MACHINE ... etc. In the IDE, type a "." after the object and look at the list of properties that are available.
 
I did try typing the "." to see my options and this time my program wouldn't run. :-\
 
I'm pretty sure Golom meant that by typing a "." while in design mode that Intellisense (I think that's what it's called???) would bring up a list of properties available to the object.

Harleyquinn

---------------------------------
For tsunami relief donations
 
Why don't you look at your documentation and see what sort of object is returned by the RegKeyFromString method?

Then you can look up that particular object and see what properties it has and figure out how to get the string you need.

If you don't have proper documentation then you can probably just figure it out by looking at it in the Object Browser.
 
Thank you for all of the suggestions I appreciate it! Sheco you're last comment prompted me to do some deeper investigative research and look for bugs in other strings that could be affecting this program and I did find the one I was looking for.

Thank you so much for all of your time again. Have a great day and enjoy your weekend!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top