IniUtil v1.11

Welcome to IniUtil, A freeware COM DLL to allow easy access to the Win32 API's which deal with INI files.

IniUtil is a dual interface COM dll which is designed to allow access to reading / writing INI files from COM enabled languages / environments including ASP, Windows Script, JScript, VBScript, VBA, Visual Basic 6, Visual C++, Delphi etc etc. Although MS recommends usage of the registry over INI files and officially says that the API's are only provided for 16 bit compatibility, many products and people find INI files easier to use, less dangerous and more portable from one machine to another than use of the registry. Due to their widespread use and the lack of COM enabled ways to get at them, IniUtil was born.

 

 

 

Features
Usage
History
API Reference
Contacting the Author

 

 

 

Features

 

 

 

Usage

 

 

 

History

v1.11 (7 May 2022)

v1.10 (10 March 2020)

v1.09 (5 October 2018)

v1.08 (2 May 2017)

v1.07 (30 October 2016)

v1.06 (18 July 2006)

v1.05 (25 August 2003)

v1.04 (30 July 2003)

30 April 2003

v1.03 (20 March 2003)

v1.02 (16 January 2003)

v1.01 (27 November 2001)

v1.0 (25 November 2001)

 

 

 

API Reference

The COM object exposes the methods and variables

 

Filename
Sections
WriteString
WriteInteger
WriteVariant
WriteSection
ReadString
ReadInteger
ReadVariant
ReadSection
ReadKeys
DeleteSection
DeleteKey

 

Filename

[Visual Basic]

Property Filename as string

Remarks

Standard Read / Write property which specifies the INI file to operate on.

 

Sections

[Visual Basic]

Property Sections as Variant

Remarks

Standard read only property which returns an array of variant strings containing the sections in the INI file. For those unfamiliar with INI files, A section in an INI file is of the following form:

[section]
key=value
      .
      .
      .

 

WriteString

[Visual Basic]

Sub WriteString(Section As String, Key As String, Value As String)

Parameters

Section The section of the INI file to write to

Key The key to use.

Value The value to write.

Remarks

Write a string to an INI file.

 

WriteInteger

[Visual Basic]

Sub WriteInteger(Section As String, Key As String, Value As Long)

Parameters

Section The section of the INI file to write to

Key The key to use.

Value The value to write.

Remarks

Writes an integer to an INI file.

 

WriteVariant

[Visual Basic]

Sub WriteVariant(Section As String, Key As String, Value as Variant)

Parameters

Section The section of the INI file to write to

Key The key to use.

Value The value to write.

Remarks

Writes a VARIANT to an INI file. Please note than only simple variant types are supported. The list of excluded types includes arrays (VT_ARRAY), COM pointers (VT_UNKNOWN and VT_DISPATCH) and by reference values (VY_BYREF). Internally the data will be character encoded to fit in the text only INI file format.

 

WriteSection

[Visual Basic]

Sub WriteSection(Section As String, KeyValues As Variant)

Parameters

Section The section of the INI file to write to

KeyValue The array of key values pairs to write. Each key value pair should be of the form "Key=Value".

Remarks

Replaces the keys and values for the specified section in an INI file.

 

ReadString

[Visual Basic]

Function ReadString(Section As String, Key As String, DefaultValue As String) As String

Parameters

Section The section of the INI file to read from

Key The key to read from.

DefaultValue The default value to return if the key is not found in the INI file.

Remarks

Reads a string from an INI file.

 

ReadInteger

[Visual Basic]

Function ReadInteger(Section As String, Key As String, DefaultValue As Long) As Long

Parameters

Section The section of the INI file to read from

Key The key to read from.

DefaultValue The default value to return if the key is not found in the INI file.

Remarks

Reads an integer from an INI file.

 

ReadVariant

[Visual Basic]

Function ReadVariant(Section As String, Key As String) As Variant

Parameters

Section The section of the INI file to read from

Key The key to read from.

Remarks

Reads a variant from an INI file.

 

ReadSection

[Visual Basic]

Function ReadSection(Section As String) As Variant

Parameters

Section The section of the INI file to read from

Remarks

Reads all key value pairs from a section in an INI file. The return value will be an array of variant strings in the form "key=value".

 

ReadKeys

[Visual Basic]

Function ReadKeys(Section As String) As Variant

Parameters

Section The section of the INI file to read from

Remarks

Reads all key from a section in an INI file. The return value will be an array of variant strings.

 

DeleteSection

[Visual Basic]

Function DeleteSection(Section As String)

Parameters

Section The section of the INI file to delete

Remarks

Deletes a specified section from an INI file.

 

DeleteKey

[Visual Basic]

Function DeleteKey(Section As String, Key As String)

Parameters

Section The section of the INI file to use

Key The specific key to delete.

Remarks

Deletes a specified key from an INI file.

 

 

 

Contacting the Author

PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
7 May 2022