Solved

searching for a key in visual basic

Posted on 2004-03-26
6
225 Views
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.
0
Comment
Question by:jardooman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 10693032
The API call to use is RegEnumKeyEx.  Here's a sample:
http://www.estescentral.net/Documentation/api/ref/r/regenumkeyex.html
0
 
LVL 30

Expert Comment

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

Author Comment

by:jardooman
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.
0
 
LVL 22

Accepted Solution

by:
cookre earned 125 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)
{
idx=0;
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
        idx+=1;
        }

}
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

733 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