Older Newer
Sun, 11 Jul 2010 21:56:57 . . . . SyneRyder [Adding a link to putRegString]


Changes by last author:

Added:
= getRegString =

== Syntax ==

:int getRegString(int szString, int iMaxLen, int szValueName[, varargs]...)

== Arguments ==

:szString

::is the address of the string to be stored or retrieved

:iMaxLen

::is the size of the szString buffer in bytes, which specifies the longest character string that can be stored in szString, including the terminating null character

:szValueName

::is the name of the string to be set or retrieved, and may contain printf-style formatting codes as well as FM !-codes.

:varargs

::is a list of optional arguments used to perform printf-style formatting on the szValueName string.

== Return ==

: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_FOUND||key or value name not found||

||ERROR_MORE_DATA||buffer wasn't big enough (e.g., getRegString, getRegData)||

||ERROR_NO_MORE_ITEMS||index >= # of values or subkeys (enumRegValue, enumRegSubKey)||

||ERROR_INVALID_FUNCTION||bad top-level key, etc||

||ERROR_INVALID_DATA||wrong data type or size (or size > 2048)||

||ERROR_BADDB||registry database is corrupt||

||ERROR_BADKEY||registry key is invalid||

||ERROR_CANTOPEN||registry key could not be opened||

||ERROR_CANTREAD||registry key could not be read||

||ERROR_CANTWRITE||registry key could not be written||

||ERROR_REGISTRY_CORRUPT||registry is corrupt||

||ERROR_REGISTRY_IO_FAILED||input/output to registry failed||

||ERROR_KEY_DELETED||Illegal operation attempted on a Registry key which has been marked for deletion.||

||ERROR_KEY_HAS_CHILDREN||cannot delete a key with subkeys (Windows NT)||

== Description ==

:Fetches a C-style character string from the Windows Registry.

:Currently, only two types of registry roots are possible, identified by the constants (HKEY_LOCAL_MACHINE)? and (HKEY_CURRENT_USER)?.

== Example ==

<code>

// 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

</code>

== Also see ==

:getRegRoot, setRegPath, putRegString

== Comments ==

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