15.5. Search the Windows Registry

Problem

You need to search the Windows registry for a key that contains a specific value or content.

Solution

Use the Microsoft.Win32.Registry class to obtain a Microsoft.Win32.RegistryKey object that represents the root key of a registry hive you want to search. Use the members of this RegistryKey object to navigate through and enumerate the registry key hierarchy, as well as to read the names and content of values held in the keys.

How It Works

You must first obtain a RegistryKey object that represents a base-level key and navigate through the hierarchy of RegistryKey objects as required. The Registry class implements a set of seven Shared properties that return RegistryKey objects representing base-level ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.