I thought I knew this but I don't.

Currently I use RegCreateKeyEx to create a key, and then I call RegSetValueEx.

Now what happens is that I create another key (folder in the regedit GUI), and I set the default value for that key (folder).

But how do I add a simple string value (not a sub folder) to that key?

Very roughly I do

RegCreateKeyEx (hKey,
                pszSubKey,
                0,    // ulOptions, must be 0
                NULL, // address of class string
                REG_OPTION_NON_VOLATILE, // special options flag
                KEY_ALL_ACCESS,        // desired security access
                NULL, // address of key security structure
                &hSubKey,          // address of buffer for opened 
                &ActionDone) ;

(void)RegCloseKey(hKey);

RegSetValueEx (hSubKey,
               L"", 
               0,  // reserved
               REG_SZ,
               (const BYTE*)pszData,  // address of value data
               ikByteCount);

...hope its clear....


Owen F. Ransen
Easy to use graphics effects:
http://www.ransen.com/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.