Declare Function GetProfileInt Lib "kernel32.dll" Alias "GetProfileIntA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Long) As Long
GetPrivateProfileInt reads an integer value the WIN.INI file. The parameters passed to the function specify which value will be read from. If successful, the function returns the value read. If the value you specify does not exist or is a string (i.e., not a number), the value specified as nDefault is returned. This is basically a watered-down version of GetPrivateProfileInt because, unlike it, this function only works with WIN.INI.
Example:
' Read the value "WallpaperStyle" under the [Desktop]
' section of WIN.INI
ret = GetProfileInt("Desktop", "WallpaperStyle", -1)
If ret = -1 Then
Debug.Print "Could not read data."
Else
Debug.Print ret
End If
Related Call: GetPrivateProfileInt, GetProfileString
Category: INI Files
Back to the index.