GetProfileInt Function

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.

lpAppName
The header of the WIN.INI file section the value is in.
lpKeyName
The name of the value to read.
nDefault
The value to return if a valid value cannot be read. Make it something that would definitely not be read, such as -1.

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.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/getprofileint.html