Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RegEnumValue

Posted on 1998-05-06
2
Medium Priority
?
533 Views
Last Modified: 2013-11-20
I just want to know the parameters declarations for the RegEnumValue function to be able to retreive values in a key. Which parameters I really need?
0
Comment
Question by:fmichaud061597
[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 Comments
 

Author Comment

by:fmichaud061597
ID: 1308110
Adjusted points to 50
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 200 total points
ID: 1308111
You need all of them, except for the "reserved" parameter.

Here's a sample:

// -- begin file enum.cpp --

// compile me with
//      cl enum.cpp


#include <windows.h>
#include <stdio.h>

#pragma comment(lib, "advapi32.lib")

void main()
{
   HKEY hKey;

   if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
      "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Extensions",
      0, KEY_READ, &hKey))
   {
      printf("It worked\n");

      DWORD dwIndex = 0;
      LONG lResult;

      while (1)
      {
         char szValue[1024];
         DWORD dwValueLen = sizeof(szValue) / sizeof(szValue[0]);
         BYTE bData[1024];
         DWORD dwDataLen = sizeof(bData) / sizeof(bData[0]);
         DWORD dwType;

         lResult = RegEnumValue(hKey, dwIndex, szValue, &dwValueLen,
            0, &dwType, bData, &dwDataLen);
         
         if (lResult == ERROR_SUCCESS)
         {
            printf("value name is \"%s\", ", szValue);

            if (dwType == REG_SZ)
               printf("Data is \"%s\"\n", bData);
            else if (dwType == REG_DWORD)
               printf("Data is 0x%8.8X\n", *((DWORD*) &bData));
            else
               printf("This program only supports DWORD and SZ\n");

            dwIndex++;
         }
         else
            break;
      }

      RegCloseKey(hKey);
   }

   return;
}

// -- end file enum.cpp --


.B ekiM
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

618 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