How to obtain registry information in C #

Source: Internet
Author: User

Implementation Method: use the registry class provided by Microsoft. win32 to access the system registry to obtain the ODBC Data Service list.
Specific implementation:
Microsoft. win32 provides the RegistryKey class to access the registry of the system.
/// Define the registry sub-Path
String strRegPath = @ "SOFTWAREODBCODBC. INIODBC Data Sources ";
/// Create two RegistryKey classes. One Class points to the Root Path and the other class points to the sub-Path.
RegistryKey regRootKey;
RegistryKey regSubKey;
/// Define Root to point to the Registry HKEY_LOCAL_MACHINE Node
RegRootKey = Registry. LocalMachine;
/// The Registry enumeration class provides the following types
/*
Registry. ClassesRoot --------------> points to the HKEY_CLASSES_ROOT node of the Registry.
Registry. CurrentConfig --------------> points to the HKEY_CURRENT_CONFIG node of the Registry.
Registry. CurrentUser --------------> points to the Registry HKEY_CURRENT_USER Node
Registry. DynData --------------> points to the HKEY_DYN_DATA node of the Registry (Dynamic Registry data)
Registry. LocalMachine --------------> points to the Registry HKEY_LOCAL_MACHINE Node
Registry. PerformanceData --------------> points to the Registry HKEY_PERFORMANCE_DATA Node
Registry. Users --------------> points to the HKEY_USERS node of the Registry.
*/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.