win12.hlp (Table of Contents; Topic list)
PrfWriteProfileString (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINSHELLDATA
 
BOOL PrfWriteProfileString(hini, pszAppName, pszKeyName, pszString)
HINI hini;         /* initialization-file handle  */
PSZ pszAppName;    /* pointer to application name */
PSZ pszKeyName;    /* pointer to keyname         */
PSZ pszString;     /* pointer to string to write */
 
The PrfWriteProfileString function places an ASCII string in the profile
file. The location of the string is determined by the application name and
keyname passed to the function. The string can then be retrieved by using
the PrfQueryProfileString function, specifying the same application name and
keyname given in the pszAppName and pszKeyName parameters of
PrfWriteProfileString.
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
hini        Identifies the file to query. This parameter can be a file
            handle or one of the following values:
 
            Value               Meaning
            ────────────────────────────────────────────────────────────────
            HINI_USERPROFILE    Specifies the user profile.
 
            HINI_SYSTEMPROFILE  Specifies the system profile.
 
pszAppName  Points to the null-terminated string that contains the
            application name. The string must be less than 1024 bytes long,
            including the terminating null character. The application name
            is case-sensitive. If no application field in the profile file
            matches pszAppName, a new application field is created.
 
pszKeyName  Points to the null-terminated string that contains the keyname.
            The string must be less than 1024 bytes long, including the
            terminating null character. If pszKeyName is NULL, all keynames
            and their data are deleted. The keyname is case-sensitive. If no
            keyname matches pszKeyName, a new keyname field is created. If
            the keyname already exists, the existing value is overwritten.
 
pszString   Points to the null-terminated ASCII string placed in the profile
            file. If pszString is NULL, the previous value associated with
            pszKeyName is deleted; otherwise, the ASCII string becomes the
            value, even if its length is zero. The string should not exceed
            64K.
 
Return Value
 
The return value is TRUE if the function is successful or FALSE if an error
occurs.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INVALID_PARM
     PMERR_MEMORY_ALLOC
     PMERR_MEMORY_ALLOCATION_ERR
     PMERR_MEMORY_DEALLOCATION_ERR
 
Comments
 
User application data should be stored in either the user profile or an
application specific profile. The system profile should be used only for
system data, such as spooler information.
 
See Also
 
PrfQueryProfileString, WinWriteProfileString