GetPrivateProfileInt

Version 3.0

Syntax

WORD GetPrivateProfileInt(lpApplicationName,lpKeyName,nDefault,lpFileName)

This function retrieves the value of an integer key from the specified initialization file.

The function searches the file for a key that matches the name specified by the lpKeyName parameter under the application heading specified by the lpApplicationName parameter. An integer entry in the initialization file must have the following form:

[application name]

keyname = value

.

.

.

Parameter Type/Description  

lpApplicationName LPSTR Points to the name of a Windows application that appears in the initialization file.  
lpKeyName LPSTR Points to a key name that appears in the initialization file.  
nDefault int Specifies the default value for the given key if the key cannot be found in the initialization file.  
lpFileName LPSTR Points to a string that names the initialization file. If lpFileName does not contain a path to the file, Windows searches for the file in the Windows directory.  

Return Value

The return value specifies the result of the function. The return value is zero if the value that corresponds to the specified key name is not an integer or if the integer is negative. If the value that corresponds to the key name consists of digits followed by nonnumeric characters, the function returns the value of the digits. For example, if the entry KeyName=102abc is accessed, the function returns 102. If the key is not found, this function returns the default value, nDefault.

Comments

The GetPrivateProfileInt function is not case dependent, so the strings in lpApplicationName and lpKeyName may be in any combination of uppercase and lowercase letters.