Click here to Skip to main content
15,907,910 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Explorer Pin
Jochen Arndt31-Jan-18 1:22
professionalJochen Arndt31-Jan-18 1:22 
AnswerRe: Explorer Pin
Randor 31-Jan-18 5:26
professional Randor 31-Jan-18 5:26 
QuestionSize of a window Pin
Anthony Appleyard29-Jan-18 5:05
Anthony Appleyard29-Jan-18 5:05 
AnswerRe: Size of a window Pin
OriginalGriff29-Jan-18 5:07
mveOriginalGriff29-Jan-18 5:07 
AnswerRe: Size of a window Pin
Victor Nijegorodov29-Jan-18 10:49
Victor Nijegorodov29-Jan-18 10:49 
GeneralRe: Size of a window Pin
Anthony Appleyard31-Jan-18 5:56
Anthony Appleyard31-Jan-18 5:56 
GeneralRe: Size of a window Pin
Richard MacCutchan31-Jan-18 6:05
mveRichard MacCutchan31-Jan-18 6:05 
QuestionClass as a DLL Pin
ForNow24-Jan-18 5:37
ForNow24-Jan-18 5:37 
AnswerRe: Class as a DLL Pin
Richard MacCutchan24-Jan-18 6:51
mveRichard MacCutchan24-Jan-18 6:51 
GeneralRe: Class as a DLL Pin
ForNow24-Jan-18 7:28
ForNow24-Jan-18 7:28 
GeneralRe: Class as a DLL Pin
Richard MacCutchan24-Jan-18 7:51
mveRichard MacCutchan24-Jan-18 7:51 
GeneralRe: Class as a DLL Pin
ForNow24-Jan-18 8:09
ForNow24-Jan-18 8:09 
GeneralRe: Class as a DLL Pin
Richard MacCutchan24-Jan-18 9:06
mveRichard MacCutchan24-Jan-18 9:06 
GeneralRe: Class as a DLL Pin
leon de boer24-Jan-18 13:02
leon de boer24-Jan-18 13:02 
AnswerRe: Class as a DLL Pin
Victor Nijegorodov24-Jan-18 9:34
Victor Nijegorodov24-Jan-18 9:34 
QuestionHow to create a thread in C Android NDK Pin
ptr_Electron22-Jan-18 3:47
ptr_Electron22-Jan-18 3:47 
QuestionRe: How to create a thread in C Android NDK Pin
Richard MacCutchan22-Jan-18 4:32
mveRichard MacCutchan22-Jan-18 4:32 
AnswerRe: How to create a thread in C Android NDK Pin
CPallini22-Jan-18 9:49
mveCPallini22-Jan-18 9:49 
QuestionRegistry returning FILE_NOT_FOUND Pin
Richard Andrew x6420-Jan-18 13:46
professionalRichard Andrew x6420-Jan-18 13:46 
I'm using a class to work with the registry that I downloaded from an MSDN article. The problem is that whenever I go to read a string (REG_SZ), the RegGetValue call fails with ERROR_FILE_NOT_FOUND (#2).

In fact no matter what I've tried, it insists on returning that error. I've tried building the program for 64-bit as well as 32 - no difference. I've made sure that the key is being opened properly. That succeeds, but reading a string value does not. I'm now pulling my hair out.

Does anyone know why it's returning ERROR_FILE_NOT_FOUND?

This is the code that's calling RegGetValue:

inline std::wstring RegGetString(HKEY hKey, const std::wstring& subKey, const std::wstring& value)
{    
    //
    // Request the size of the string, in bytes
    //
    DWORD dataSize{};
    LONG retCode = ::RegGetValue(
        hKey,
        subKey.c_str(),
        value.c_str(),
        RRF_RT_REG_SZ,
        nullptr,
        nullptr,
        &dataSize);
    if (retCode != ERROR_SUCCESS)
    {
        throw RegistryError{ "Cannot read string from registry", retCode };
    }


These are the relevant values: hKey is HKEY_CURRENT_USER,
subKey is "Software\Microsoft\Windows\CurrentVersion\Run" The string is properly escaped.
and value is a REG_SZ entry.



The difficult we do right away...
...the impossible takes slightly longer.

AnswerRe: Registry returning FILE_NOT_FOUND Pin
Randor 20-Jan-18 16:40
professional Randor 20-Jan-18 16:40 
GeneralRe: Registry returning FILE_NOT_FOUND Pin
Richard Andrew x6421-Jan-18 2:16
professionalRichard Andrew x6421-Jan-18 2:16 
GeneralRe: Registry returning FILE_NOT_FOUND Pin
Randor 21-Jan-18 6:26
professional Randor 21-Jan-18 6:26 
GeneralRe: Registry returning FILE_NOT_FOUND Pin
Richard Andrew x6421-Jan-18 9:32
professionalRichard Andrew x6421-Jan-18 9:32 
QuestionRe: Registry returning FILE_NOT_FOUND Pin
Richard MacCutchan20-Jan-18 21:11
mveRichard MacCutchan20-Jan-18 21:11 
AnswerRe: Registry returning FILE_NOT_FOUND Pin
Victor Nijegorodov21-Jan-18 1:07
Victor Nijegorodov21-Jan-18 1:07 

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.