GetProfInt

InstallShield 2020 » InstallScript Language Reference

The GetProfInt function retrieves an integer from an .ini file. GetProfInt works like the Windows API GetPrivateProfileInt with the nDefault parameter specified as 0.

Syntax

GetProfInt ( szFileName, szSectionName, szKeyName, nvValue );

Parameters

GetProfInt Parameters

Parameter

Description

szFileName

Specifies the name of the .ini file from which to get the current integer value of a key. If szFileName is unqualified (that is, if a drive designation and path are not included), InstallShield searches for the file in the Windows folder.

szSectionName

Specifies the name of the .ini file section to search for szKeyName. The section name should not be enclosed within delimiting brackets ( [ ] ). The search for this name is not case-sensitive.

szKeyName

Specifies the key whose integer value is to be returned in nvValue. The search for this key is not case-sensitive.

nvValue

Returns an integer value currently assigned to szKeyName. Due to limitations of the GetPrivateProfileInt function, this function can return only a 16-bit value from the profile. Therefore, the maximum value that can be returned is 65,535; larger values may not be returned correctly. If you need to return a larger value, use the general file handling functions, such as FileGrep and FileInsertLine, and then convert the returned string into an integer by calling StrToNum.

Return Values

GetProfInt always returns 0.

Additional Information

As with the Windows API function GetPrivateProfileInt, no error is returned if an error occurs because the file, section, or key name cannot be found. Instead, nvValue will contain 0. For that reason, it is not possible to distinguish between an error and a returned value of zero. To distinguish between zero and an error, call GetPrivateProfileInt directly and specify an alternate default value.
Some calls to GetPrivateProfileInt—and therefore to GetProfInt—are mapped automatically to the Windows registry instead of the profile.

See Also