المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : CRegKey read from registry?



C++ Programming
09-25-2013, 11:15 PM
Hi,
i need some help with CRegKey to read from registry http://www.barakasoft.com/script/Forums/Images/smiley_frown.gif

Here what works fine:

int *target = NULL;
AfxGetApp()->GetProfileBinary(m_strKey, _T("key"), (BYTE **)&target, &bytes);


but i need to do this with registry key, like:

// CRegKey is there and opened without errors
int *target = NULL;
myregkey.QueryBinaryValue(_T("key"), (BYTE**)&target, &bytes);

Error is allways ERROR_MORE_DATA what means they are more information to read as i do?
To write binary data to registry works fine to, only read is my problem now.
Only for example here how i write binary to registry:

int *value = new int[count];
myregkey.SetBinaryValue(_T("key"), (BYTE*)value, sizeof(int) * count);


Can somebody help me how to read binary from registry with CRegKey::QueryBinaryValue??

Thanks in advance
bosfan