Click here to Skip to main content
15,913,270 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblems with CreateDesktop Pin
GauranG Shah5-Oct-07 4:17
GauranG Shah5-Oct-07 4:17 
QuestionVC8 and stingray DLL issue Pin
OmniX5-Oct-07 3:42
OmniX5-Oct-07 3:42 
QuestionSomething about CxImage class Pin
Jane1315-Oct-07 2:52
Jane1315-Oct-07 2:52 
QuestionRe: Something about CxImage class Pin
Hamid_RT5-Oct-07 3:01
Hamid_RT5-Oct-07 3:01 
AnswerRe: Something about CxImage class Pin
Jane1316-Oct-07 1:39
Jane1316-Oct-07 1:39 
GeneralRe: Something about CxImage class Pin
Hamid_RT6-Oct-07 19:24
Hamid_RT6-Oct-07 19:24 
GeneralRe: Something about CxImage class Pin
Jane13119-Oct-07 16:05
Jane13119-Oct-07 16:05 
GeneralRe: Something about CxImage class Pin
Hamid_RT21-Oct-07 19:38
Hamid_RT21-Oct-07 19:38 
GeneralRe: Something about CxImage class Pin
Jane13125-Oct-07 3:35
Jane13125-Oct-07 3:35 
GeneralRe: Something about CxImage class Pin
Hamid_RT25-Oct-07 4:42
Hamid_RT25-Oct-07 4:42 
GeneralRe: Something about CxImage class Pin
Jane13125-Oct-07 15:35
Jane13125-Oct-07 15:35 
GeneralRe: Something about CxImage class Pin
Hamid_RT25-Oct-07 20:48
Hamid_RT25-Oct-07 20:48 
QuestionRe: Something about CxImage class Pin
Hamid_RT28-Oct-07 21:23
Hamid_RT28-Oct-07 21:23 
GeneralRe: Something about CxImage class Pin
quiettimes8-Jan-08 23:46
quiettimes8-Jan-08 23:46 
QuestionCRegKey::QueryValue (...) fails [modified] Pin
Nelek5-Oct-07 2:47
protectorNelek5-Oct-07 2:47 
AnswerRe: CRegKey::QueryValue (...) fails Pin
David Crow5-Oct-07 3:34
David Crow5-Oct-07 3:34 
GeneralRe: CRegKey::QueryValue (...) fails Pin
Nelek8-Oct-07 3:45
protectorNelek8-Oct-07 3:45 
AnswerRe: CRegKey::QueryValue (...) fails Pin
Rahul Vaishnav5-Oct-07 4:18
Rahul Vaishnav5-Oct-07 4:18 
GeneralRe: CRegKey::QueryValue (...) fails Pin
David Crow5-Oct-07 5:42
David Crow5-Oct-07 5:42 
GeneralRe: CRegKey::QueryValue (...) fails Pin
Nelek8-Oct-07 3:47
protectorNelek8-Oct-07 3:47 
AnswerRe: CRegKey::QueryValue (...) fails Pin
Roger Stoltz5-Oct-07 4:38
Roger Stoltz5-Oct-07 4:38 
It looks like you're able to successfully open the registry key.
Your problem is when you're trying to read the contents of the value "IFPARA_TCPIP".

Nelek wrote:
Can someone tell me what am I not understanding?


Basically you haven't understood how to use this function and how to interpret the error returned.
The error returned tells that there is more data to be read, i.e. the size of the buffer you provided was too small to hold the contents of the registry value. The length returned is the complete length that is required to hold the data, i.e. 1252 bytes.
Try this after you've opened the registry key successfully (non CRegKey version):
BYTE* pBuffer = NULL; // Buffer to receive the data in
lnResult = ::RegQueryValueEx( hWkKey, "IFPARA_TCPIP", 0, NULL, NULL, &iLength ); // Get the required size
if( (lnResult == ERROR_SUCCESS) && iLength )
{
    DWORD dwType;
    pBuffer = new BYTE[iLength]; // Allocate memory
    ::RegQueryValueEx( hWkKey, "IFPARA_TCPIP", 0, &dwType, pBuffer, &iLength ); // Read the contents
    if( dwType == REG_SZ )
    {
        // The registry value is a string, it could be something else though so we better make sure
        szValue = pBuffer;
    }
    delete [] pBuffer;
    pBuffer = NULL;
}


Read more about ::RegQueryValueEx() here[^] and a list of possible data types to store in the registry here[^].


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown

GeneralRe: CRegKey::QueryValue (...) fails Pin
Nelek8-Oct-07 3:59
protectorNelek8-Oct-07 3:59 
GeneralRe: CRegKey::QueryValue (...) fails Pin
Roger Stoltz15-Oct-07 1:37
Roger Stoltz15-Oct-07 1:37 
QuestionI wanted to see (and play with) an example using CORBA, so I downloaded a 60 day trial of Borlands Visibroker. Pin
Andy2025-Oct-07 2:42
Andy2025-Oct-07 2:42 
QuestionRe: I wanted to see (and play with) an example using CORBA, so I downloaded a 60 day trial of Borlands Visibroker. Pin
rosdiana28-May-08 23:18
rosdiana28-May-08 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.