Solved

searching for a key in visual basic

Posted on 2004-03-26
6
228 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Six Sigma Control Plans

687 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