[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2002-03-08
1
Medium Priority
?
267 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 520 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

829 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