Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

RegEnumKeyEx example

Posted on 1997-10-26
1
Medium Priority
?
3,141 Views
Last Modified: 2013-12-03
Hi,
I Need an example with RegEnumKeyEx.
Thanx
0
Comment
Question by:puce020497
[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
1 Comment
 

Accepted Solution

by:
jasiek earned 200 total points
ID: 1407882
In this routine you query registry to combobox:

HKEY reg_key;
char buff[0xffff]; // temp buffer
DWORD bufflen=sizeof(buff);
int index;
CComboBox m_KeyList; // return value object

CString YOUR_MASTER_KEY="Software\\your_app\\your_subkey\\";
CString REG_YOUR_ENTRY="Profile";
if(RegOpenKeyEx(HKEY_CURRENT_USER,
YOUR_MASTER_KEY+REG_YOUR_ENTRY,
0,
KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
&reg_key)!=ERROR_SUCCESS)
{
// key not found
}

index=0;
bufflen=sizeof(buff);
      while(RegEnumKeyEx(reg_key,
index,
buff,
&bufflen,0,0,0,0)==ERROR_SUCCESS)
{
      if(buff[0]!=0)
      m_KeyList.AddString(buff);
      index++;
      bufflen=sizeof(buff);
}
RegCloseKey(reg_key);
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

715 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