Link to home
Start Free TrialLog in
Avatar of Quantster
Quantster

asked on

How to check if a Registry key exists in VB6.0

I want to check if a registry key exists in VB6.0. How do I do that.

Thanks
Quantster
Avatar of ladarling
ladarling
Flag of United States of America image

If you just want to check if it exists, use GetSetting()
http://msdn.microsoft.com/en-us/library/kb0c3wb9(VS.71).aspx
You can also download and use the RegistryObject from MS that allows you to interact with the registry pretty easily without the using API:
http://download.microsoft.com/download/vb60pro/update/6.0/w9x2k/en-us/regobji.exe
 
If you just want to check if it exists, use GetSetting()
Thats probably misleading.... This function will only check the portion of the registry used by VB applications. If you need to get access to another area, the RegistryObject is your friend.
Avatar of Quantster
Quantster

ASKER

Actually I want to use the API. Thats what I was looking for. Let me give this a try.
Back in the day, I used one created by TheScarms.  The site is really chock full of API tricks, which I'm sure you'll like!

http://www.thescarms.com/VBasic/registry.aspx
I am kind of having difficulty doing this. GetSetting seems to retrive Keys only from the user specific portion (HKEY_CURRENT_USER). My key is located in the HKEY_LOCAL_MACHINE? I am little confused. Do you guys have some sample source code.

Thanks
Quantster
The GetSetting method does not use the API, that is what I was trying to clarify above. To use the Windows API to manipulate the registry, check this out:
http://support.microsoft.com/kb/145679
The registry object that I posted above encapsulates these API calls into a more user friendly control. Either will get the job done, though.
ASKER CERTIFIED SOLUTION
Avatar of MTEXX
MTEXX
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial