Function Windows API Class

GetPrivateProfileInt

"Get Private Profile Integer" Get the value of an Integer numeric setting from a Windows Private Profile (INI) file. Function returns a Long value.

Signature (Visual Basic / VBA)

Public Function GetPrivateProfileInt( _
      ByVal vKeyName As Variant _
    , Optional ByVal vDefault As Variant _
    , Optional ByVal vSectionName As Variant _
    , Optional ByVal vFileName As Variant _
    ) As Variant

Code Example

    Assuming
       Dim estWAPI As New WindowsAPI
       estWAPI.ProfileFileName = "Sample.Ini"
       estWAPI.ProfileSectionName = "Sample Section"
       estWAPI.WritePrivateProfileInt("Major Version", 5) = True
    for example
       estWAPI.GetPrivateProfileInt("Major Version") = 5

Parameters

Parameter Description
vKeyName Name of the numeric setting whose value is to be retrieved. Function returns Null if vKeyName is Null or cannot be fixed-up to a String.
vDefault Default value that will be returned by this function where there is no setting with the specified Name. vDefault defaults to 0 (zero) if it is missing or Null or cannot be fixed-up to a number.
vSectionName The Section within the Private Profile file that contains the Setting. vSectionName defaults to the current value of the ProfileSectionName Property if it is missing or Null or cannot be fixed-up to a String.
vFileName The name of the Private Profile (INI) File that contains the Setting. vFileName defaults to the current value of the ProfileFileName Property if it is missing or Null or cannot be fixed-up to a String.

Notes & Version History

v1.3 Change Removed 16-bit support from this function.