Codebox Software

INIFile DLL

Published:

INIFile.DLL is a COM DLL providing easy access to INI files. The DLL encapsulates the Win32 API functions GetPrivateProfileString, WritePrivateProfileString, GetPrivateProfileSection and WritePrivateProfileSection allowing values and even whole sections to be read and written. The library also provides some functionality not directly supported by the API - such as the deletion.

In addition, the various Sections and Keys within the INI file are represented by collections of objects, allowing for easy iteration through the data. Various 'helper' functions are also provided, allowing common tasks to be performed with a single method call. In addition, the library includes functions to encode binary data, such as byte-arrays, using only alpha-numeric characters that may be safely written to an INI file key.

Class Model for INIFile.DLL
 
VB Class clsHelper VB Method CreateNew  Function CreateNew(sFile As String, [sDirectory As String = ""]) As clsINIFile
VB Method OpenExisting  Function OpenExisting(sFile As String, [sDirectory As String = ""]) As clsINIFile
 
VB Class clsINIFile VB Method AddNewSection  Function AddNewSection(sSectionName As String) As clsSection
VB Method DeleteKey  Sub DeleteKey(sSection As String, sKey As String)
VB Method DeleteSection  Sub DeleteSection(sSection As String)
VB Property File  Property File As String
VB Method GetSection  Function GetSection(sSection As String) As clsSection
VB Method GetValue  Function GetValue(sSection As String, sKey As String) As String
VB Method KeyExists  Function KeyExists(sSection As String, sKey As String) As Boolean
VB Method RetrieveByteArray  Function RetrieveByteArray(sSectionName As String, sKeyName As String) As Byte()
VB Method SectionExists  Function SectionExists(sSection As String) As Boolean
VB Property Sections  Property Sections As clsSections
VB Method SetValue  Sub SetValue(sSection As String, sKey As String, sValue As String)
VB Method StoreByteArray  Function StoreByteArray(sSectionName As String, sKeyName As String, arrData() As Byte) As clsKey
 
VB Class clsKey VB Property Name  Property Name As String
VB Property Value  Property Value As String
 
VB Class clsKeys VB Method Add  Function Add(sKey As String, sValue As String) As clsKey
VB Property Count  Property Count As Integer
VB Method Def Item  Function Item(sName As String) As clsKey
VB Method NewEnum  Function NewEnum() As IUnknown
VB Method Refresh  Sub Refresh()
VB Method Remove  Sub Remove(sKey As String)
 
VB Class clsSection VB Property Keys  Property Keys As clsKeys
VB Property Name  Property Name As String
 
VB Class clsSections VB Method Add  Function Add(sSectionName As String) As clsSection
VB Property Count  Property Count As Integer
VB Method Def Item  Function Item(sName As String) As clsSection
VB Method NewEnum  Function NewEnum() As IUnknown
VB Method Refresh  Sub Refresh()
VB Method Remove  Sub Remove(sSectionName As String)