AddProfString

InstallShield 2020 » InstallScript Language Reference

The AddProfString function unconditionally adds a profile string to an .ini file. Use AddProfString only to add non-unique keys, such as those found in the [386Enh] section of the System.ini file (device = ...). AddProfString adds the line KEY=VALUE to the end of the specified .ini file section. It does not replace or update an existing key. To update an existing non-unique key, call ReplaceProfString. To add a unique key or to update an existing unique key's value in an .ini file, call WriteProfString.

Syntax

AddProfString ( szFileName, szSectionName, szKeyName, szValue );

Parameters

AddProfString Parameters

Parameter

Description

szFileName

Specifies the name of the .ini file to which the profile string is to be added. If szFileName is unqualified (that is, if a drive designation and path are not included), InstallShield searches for the file in the Windows folder. If the file does not exist, it is created in the specified folder; if a path is not included in file name, the file is created in the Windows folder. If the file name is qualified with a path that does not exist, AddProfString fails.

szSectionName

Specifies the name of a section in the .ini file section. The profile string is inserted at the end of that section. If the section does not exist, InstallShield creates it. The section name should not be enclosed within delimiting brackets ( [ ] ). Note that the profile string is inserted even if the key specified by szKeyName already exists in that section.

szKeyName

Specifies the name of the key to insert. The value of this parameter will appear to the left of the equal sign in the profile string (szKeyName = szValue).

szValue

Specifies the value to assign to the key. The value of this parameter will appear to the right of the equal sign in the profile string (szKeyName = szValue).

Return Values

AddProfString Return Values

Return Value

Description

0

AddProfString successfully added the specified profile string to the .ini file.

< 0

AddProfString was unable to add the profile string.

Additional Information

AddProfString does not use the Windows API to change the .ini files. The Windows API cannot handle the types of changes possible with AddProfString.
Changes made to .ini files can be logged for uninstallation. However, there are some important restrictions to be aware of. For more information, see Uninstalling Initialization (.ini) File Entries.

See Also