BOOL WriteProfileString(lpApplicationName,lpKeyName,lpString)
This function copies the character string pointed to by the lpString parameter into the Windows initialization file, WIN.INI. It searches WIN.INI for the key named by the lpKeyName parameter under the application heading specified by the lpApplicationName parameter. If there is no match, it adds to the user profile a new string entry containing the key name and the key value specified by the lpString parameter. If there is a matching key, the function replaces that key's value with lpString.
Parameter | Type/Description |
lpApplicationName | LPSTR Points to an application heading in WIN.INI. | |
lpKeyName | LPSTR Points to a key name that appears under the application heading WIN.INI. | |
lpString | LPSTR Points to the string that contains the new key value. |
The return value specifies the result of the function. It is nonzero if the function is successful. Otherwise, it is zero.
If there is no match for lpApplicationName, this function creates a new application field and adds the string pointed to by lpString.
A string entry in WIN.INI has the following form:
[application name]
keyname = string
.
.
.
An application can also call WriteProfileString to delete lines from WIN.INI. If lpString is NULL, the function deletes the entire line identified by the lpKeyName parameter. If lpString points to a null string, the function deletes only the value; the key name remains in the file. If lpKeyName is NULL, the function deletes the entire section identified by the lpApplicationName parameter; however, the function does not delete any lines beginning with the semicolon (;) comment character.