?
Solved

searching for a key in visual basic

Posted on 2004-03-26
6
Medium Priority
?
232 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 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)
{
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

777 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