Re: RegQueryValueEx retrieved only one letter
- From: "Tom Serface" <tom.nospam@xxxxxxxxxxxxx>
- Date: Tue, 10 Jul 2007 23:00:28 -0700
You may find a class like one of these to be useful as well. It could save you some time:
http://www.codeproject.com/system/CRegistry.asp
http://www.codeproject.com/system/CPPRegistryWrapper.asp
http://www.codeproject.com/system/cpjregistry.asp
Tom
"fifth" <fifth8118@xxxxxxxxx> wrote in message news:1184120191.196709.143650@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I want to retrieve the string value of a register key which is "C:
\program files\test", but every time I only get one letter as "C"
returned. My code is as follows, can somebody help me find out what
happened?
///////////////////////////////////////////////////////////////////////////////////////
HKEY hKEY
LPCTSTR data_Set=_T("Software\\test\\Settings");
long ret0=(::RegOpenKeyEx (HKEY_CURRENT_USER, data_Set, 0,
KEY_READ, &hKEY));
if(ret0!=ERROR_SUCCESS)
AfxMessageBox(_T("error: cannot open hKEY!"));
char *szPath = new char[256];
DWORD type_1=REG_SZ ;
DWORD cbData_1=80;
long ret1=::RegQueryValueEx(hKEY,_T("InstallPath"), NULL,&type_1,
(BYTE *)szPath, &cbData_1);
if(ret1!=ERROR_SUCCESS)
AfxMessageBox(_T("error, cannot query hKEY!"));
::RegCloseKey(hKEY);
USES_CONVERSION;
AfxMessageBox(A2T(ch));
delete szPath;
.
- References:
- RegQueryValueEx retrieved only one letter
- From: fifth
- RegQueryValueEx retrieved only one letter
- Prev by Date: Re: Controls - Not receiving key messages ON_WM_KEYDOWN
- Next by Date: Disabling System Menu on the dialog
- Previous by thread: Re: RegQueryValueEx retrieved only one letter
- Next by thread: CToolTipCtrl - popup not being displaying, unless Invalidate is called
- Index(es):
Loading