Solved

Error 234 with CRegKey. Empty String values.

Posted on 1998-10-20
2
425 Views
Last Modified: 2008-03-10
When I use CRegKey.QueryValue I get the correct number of letters in the string, but my LPTSTR is always empty. The error that is returned is 234 which is ERROR_MORE_DATA. What does this mean? And why does it only do half of what it's supposed to do?

//Here is the line (note, opening the key is ERROR_SUCCESS):
error_num = key.QueryValue(lpStringVal, "LocalService", &dwStringSize);

//dwStringSize is 39 (the correct number)
//but lpStringVal is empty.
0
Comment
Question by:xxchange
2 Comments
 

Accepted Solution

by:
dirty_dog earned 50 total points
ID: 1175653
You need to initialize dwStringSize to the maximum number of letters that lpStringVal can hold.  Then QueryValue will replace it with the letters actually read.

This allows you to query the value once with 0 bytes, allocate enough memory to hold the value, and then query again for the actual value.
0
 

Author Comment

by:xxchange
ID: 1175654
Thanks alot. Worked like a charm. You rock.


0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

776 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