searching for a key in visual basic

Posted on 2004-03-26
Medium Priority
Last Modified: 2013-11-13
I'm trying to use visual basic to serarch for a speific key in the registry. I know it rewuires the use of an API call but I can't find one that does what I would like it to do.
Question by:jardooman
  • 2
LVL 22

Expert Comment

ID: 10693032
The API call to use is RegEnumKeyEx.  Here's a sample:
LVL 30

Expert Comment

by:Mayank S
ID: 10701353
If you are on VB .NET, then you can use the RegistryKey class.

Author Comment

ID: 10704375
I am familiar with the regenumkey but I can only get it to go in one level. The key I'm trying to find is within a folder that I may not always know the name of.
LVL 22

Accepted Solution

cookre earned 500 total points
ID: 10705862
That's why you have to walk the registry tree, recursively calling RegEnumKeyEx on each sub-key.

something like this:
bool EnumNode(HKEY KeyToDo)
rc = RegEnumKeyEx(KeyToDo,idx,...);
while (rc==ERROR_SUCCESS)
        if (this is the one you're looking for)
           do something
           return true;
        Open this subkey
        if (EnumNode(thissubkey))  {close subkey; return true;)
        close subkey


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In this post we will learn different types of Android Layout and some basics of an Android App.
Today, unlike web development, the mobile landscape is complex enough for a software engineer and Android is posing more challenging environment thanks to its fragmentation issues on hardware and software fronts.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Screencast - Getting to Know the Pipeline

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question