Garmaine Staff asked 2 years ago

My problem is that, I can't retrieve a Registry value correctly in a hex format, converting it to a string so it appears this way in my ListBox (image 1), I know how to do it correctly in C#, but I'm new to C++.

String ks;
DWORD reg2()
{


        char value[255];

        DWORD BufferSize = BUFFER;

        RegGetValue(HKEY_CURRENT_USER, namebuf, "415846243", RRF_RT_ANY, NULL, (PVOID)&value, &BufferSize);

        std::wstringstream box_messages;
        box_messages << value;
        ks = box_messages.str().c_str();

}

void __fastcall TAAP_Test::Button1Click(TObject *Sender)
{
     ListBox1->Items->Add(ks);
}

This image shows the result on my program:

image

This image shows what registry value I'm trying to retrieve:

image