int putRegString(int szString, int szValueName[, varargs]...)


is the address of the string to be stored
is the name of the string to be retrieved, and may contain printf-style formatting codes as well as FM !-codes.
is a list of optional arguments used to perform printf-style formatting on the szValueName string.


Returns ERROR_SUCCESS if the operation was successful, otherwise it returns one of the following integer error codes:
ERROR_SUCCESS(==0) no error
ERROR_FILE_NOT_FOUNDkey or value name not found
ERROR_MORE_DATAbuffer wasn't big enough (e.g., getRegString, getRegData)
ERROR_NO_MORE_ITEMSindex >= # of values or subkeys (enumRegValue, enumRegSubKey)
ERROR_INVALID_FUNCTIONbad top-level key, etc
ERROR_INVALID_DATAwrong data type or size (or size > 2048)
ERROR_BADDBregistry database is corrupt
ERROR_BADKEYregistry key is invalid
ERROR_CANTOPENregistry key could not be opened
ERROR_CANTREADregistry key could not be read
ERROR_CANTWRITEregistry key could not be written
ERROR_REGISTRY_CORRUPTregistry is corrupt
ERROR_REGISTRY_IO_FAILEDinput/output to registry failed
ERROR_KEY_DELETEDIllegal operation attempted on a Registry key which has been marked for deletion.
ERROR_KEY_HAS_CHILDRENcannot delete a key with subkeys (Windows NT)


Stores a C-style character string in the Windows Registry.
Currently, only two types of registry roots are possible, identified by the constants (HKEY_LOCAL_MACHINE)? and (HKEY_CURRENT_USER)?.


// Saves a title for your filter dialog box, and retrieves it on next invocation
putRegString("Filter #2", "Dialog title");  //save title for next time
        . . .

getRegString(str0, 256, "Dialog title");    //retrieve saved title
if (strcmp(str0, "")==0) {
    //title is null or missing...
    strcpy(str0, "Default title");  //set a default title
setDialogText(str0);   //set title for our filter dialog

Also see

getRegRoot, setRegPath, getRegString


Note that this function does not work for REG_EXPAND_SZ strings, which are a different data type to standard REG_SZ strings.