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

inifiles.zip

Size:

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!

Syntax

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

Parameters

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

Type of data

String

Returns

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

-

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: webmaster@vbprogzone.cjb.net
Hosted by InWind: www.inwind.it