You can't use std::string and remain unicode aware. Today, I would say
using char strings is a bug. Always use TCHAR or wchar_t as character type.
If you really need std::basic_strings, then instanciate create your own
string class:
typedef std::basic_string<TCHAR> tstring;
However, usually you should stick to CString in MFC applications.
If you want std::string, I would just do something like
DWORD dwType;
DWORD dwLen = 30000;
BYTE value[30000];
This is very bad coding style and will silently fail once the returned
data is longer than 30000 bytes. And if it is shorter, its a waste of
resources.
You should query how much data you need, and allocate that dynamically.
CString can handle this much better.
And how about unicode?
RegQueryValueEx(hSubKey,
"ChapContents",
NULL,
&dwType,
value,
&dwLen);
std::string ssRegString((const char*)value);
Unneccessary type cast.
of std::string.
Not sure I agree with you about the type cast. Don't I need a cast to
rate, the cast makes it clear what is intended here.