UINT GetPrivateProfileInt(lpszSection, lpszEntry, dwDefault, lpszFile) | |||||
LPCTSTR lpszSection; | /* address of the section name | */ | |||
LPCTSTR lpszEntry; | /* address of the key name | */ | |||
DWORD dwDefault; | /* return value if key name is not found | */ | |||
LPCTSTR lpszFile; | /* address of initialization file name | */ |
The GetPrivateProfileInt function retrieves the value of an integer from an entry within a specified section of a specified initialization file.
lpszSection
Points to a null-terminated string containing the section heading in the initialization file.
lpszEntry
Points to the null-terminated string containing the keyname whose value is to be retrieved.
dwDefault
Specifies the default value to return if the keyname cannot be found in the initialization file.
lpszFile
Points to a null-terminated string that names the initialization file. If lpszFile does not contain a full path, Windows searches for the file in the Windows directory.
If the function is successful, The return value is the value of the string following lpszEntry in lpszFile. If the key is not found, the return value is dwDefault.
The return value is zero if the keyname value is negative.
The GetPrivateProfileInt function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
The function searches the file for a key that matches the name specified by the lpszEntry parameter under the section heading specified by the lpszSection parameter. An integer entry in the initialization file must have the following form:
[section name]
keyname = value
.
.
.
The GetPrivateProfileInt function is not case dependent, so the strings in lpszSection and lpszEntry may be in any combination of uppercase and lowercase letters.
A program can use the GetProfileInt function to retrieve an integer value from the WIN.INI file.
GetPrivateProfileString, GetProfileInt, GetProfileString