Reputation: 799
I am unable to retrieve string value from registry using CRegKey::QueryStringValue() Here is my code please let me know where am going worng.Here is the code.
bool bResult;
int nSize = 50;
LPTSTR csKeyValue = NULL;
bResult = m_cKey.QueryStringValue(_T(REGISTRY_VALUE_NAME),csKeyValue,(ULONG*)&nSize);
if(bResult == ERROR_SUCCESS){
return true;
}
Somebody please help me and point me to right direction. Thanks in advance.
Upvotes: 0
Views: 496
Reputation: 10425
csKeyValue must be a pointer to a buffer that will receive the string data. Yours is pointing to NULL, which will not work. Declare a buffer with an ample size, such as wchar_t KeyValue[1024] and pass KeyValue.
Upvotes: 1