Solved

How can I get all data names and values in a subkey in the registry?

Posted on 2002-03-08
1
244 Views
Last Modified: 2010-04-01
How can I get all data names and values in a subkey in the registry? If a key have many Data names and value what is the way to get all data name and its values?
support with code Please .
0
Comment
Question by:AHD
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 130 total points
ID: 6850314
Use 'RegEnumValue()' - a sample can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/regapi_0tq1.asp ("Using the Registry"):

    if (cValues)
    {
        for (j = 0, retValue = ERROR_SUCCESS;
                j < cValues; j++)
        {
            cchValue = MAX_VALUE_NAME;
            achValue[0] = '\0';
            retValue = RegEnumValue(hKey, j, achValue,
                &cchValue,
                NULL,
                NULL,    // &dwType,
                NULL,    // &bData,
                NULL);   // &bcData
 
            if (retValue != (DWORD) ERROR_SUCCESS && 
                    retValue != ERROR_INSUFFICIENT_BUFFER)
            {
                wsprintf (achBuff,
                    "Line:%d 0 based index = %d, retValue = %d, " 
                     "ValueLen = %d",
                     __LINE__, j, retValue, cchValue);
                MessageBox (hDlg, achBuff, "Debug", MB_OK);
            }
 
            achBuff[0] = '\0';
 
            // Add each value to a list box.
            if (!lstrlen(achValue))
                lstrcpy(achValue, "<NO NAME>");
            wsprintf(achBuff, "%d) %s ", j, achValue);
            SendMessage(GetDlgItem(hDlg,IDL_LISTBOX2),
                LB_ADDSTRING, 0, (LONG) achBuff);
        }
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

860 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