INI files management
By: John A. Nyhart Date: 18/07/1997


908 bytes

Download now!

This great function will manage INI files and do all the API work for you! With a single function you'll be able to write or read settings from multi-section INI files!


ReadWriteINI(inifile, mode, section, key, [value])


inifile: name and path of the INI file to manage
: may be WRITE or GET
section: name of the INI file section
: name of the setting to write or get
value: default value for GET mode, value to write for WRITE mode (optional)

Type of data



OK for a successfull WRITE.
The read value for a successfull


Example: to get the setting maxentries from the [Recent Files] section and store it max variable, we'll use this code:

max = ReadWriteINI("MyApp.Ini","Recent Files","maxexntries",4)

If the key does not exits, a default value of 4 will be returned.
To write the same information to the ini file, we'll type:

ReadWriteINI("MyApp.Ini","Recent Files","maxentries",max)

The function and its API declarations are contained in a module. You can cut and paste them in any program of yours.

Click Here!

Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
Webmaster's e-mail:
Hosted by InWind: