• Description

    This is a sample how to read "MaxPagePerEnvelope" from PMachine.ini. Define sSection and sKey to get the entries from ini file. These entries can be made manually or using the function WritePrivateProfileString.

  • Answer

    Example of PMachine.ini entry:

    VB Application.BAS

    Public lMaxPagePerEnvelope As Long
     'this variable can be used in all VB sheets. Example is executed on event 'OnApplicationStart'.
    Public Declare Function GetPrivateProfileString Lib "Kernel32" _
     Alias "GetPrivateProfileStringA" ( _
     ByVal lpApplicationName As String,
     ByVal lpKeyName As String, _
     ByVal lpDefault As String, _
     ByVal lpReturnString As String, _
     ByVal nSize As Long, _
     ByVal lpFilename As String) As Long

    Public Function Get_Ini(sSection As String, sKey As String) As String
     Dim sLine As String
     sLine = Space(100)
     Get_Ini = Left(sLine, getPrivateProfileString(sSection, sKey, "", sLine, 100, App.INIFile))
    End Function

    Private Sub OnApplicationStart()
     lMaxPagePerEnvelope = Val(Get_Ini("CustomerSettings","MaxPagePerEnvelope"))
    End Sub

    More info about GetPrivateProfileString

Date created:
01/22/2015 11:38:32
Last updated:
02/11/2015 10:25:44