Getting data from RegEnumValue

In Visual C++ v5 I am looping through registry entries picking up the subgroups using RegEnumKey and I now wish to extract the data from an entry in the subgroup eg Title in HKEY_LOCAL_MACHINE\software\microsoft\browser\CurrentVersion\Title.
My RegEnumValue reads a couple of entries then gives RC 234 (ERROR_MORE_DATA I think) My result string is 1000 bytes.
What am I doing wrong? I am so close but can't figure it out.
Who is Participating?
nietodConnect With a Mentor Commented:
Use RegQuerryValueEx() instead.  If you specify too short of a buffer to this procedure, it will return 234 also, but it will store the length needed for the buffer in the first 4 bytes of the buffer you specify.  So you can use this length to allocate a new buffer that is long enough.

Let me know if you have any questions.
cjbezantAuthor Commented:
Many thanks nietod, this indeed has solved my problem.

There are a acouple of other things I need to crack. I need to put a bitmap as the background to my dialog boxes and I need to increase the text size of my static text that form the heading for a listbox. In VB this was easy-peasy but in VC++ I can't find how to do it.

Do you have any book recommendations to help me learn VC++ MFC and would include these topics?

Thanks again for your help. The registry was a major stumbling block for me. None of the online help explains it.
These really should be asked as seperate questions, but briefly,

>>bitmap as the background to my dialog boxes
Draw the bitmap with BitBlt(0 (or one of its related procedures) during the dialog's WM_PAINT message.

>> increase the text size of my static text
Send the control a WM_SETFONT message.

>> book recommendations to help me learn VC++ MFC
I recommend you learn the basics of windows programming BEFORE learning MFC.  MFC makes it easier by hiding lots of details, but that is not necessarly the best way to start out, first you should learn about those details, then you will be better prepared to handle probkems.  I would start with the charles Petzold book "Programming Windows" (I believe its called).  Then try one of the many MFC books.
cjbezantAuthor Commented:

I wasn't trying to short circuit the system, just a drowniong man clasping at a straw!

Thanks again.
Just ask another qeustion or two to keep the DB well organized.  (all questions are saved for posterify).  If you run low on points, as a low point value question and let the experts know you are running low, they will usually still answer
All Courses

From novice to tech pro — start learning today.