This article was previously published under Q74608
This article has been archived. It is offered "as is" and will no longer be updated.
An application should use a private profile (INI) file to storeinitialization information where possible rather than the main INIfile in Windows, WIN.INI. Profile files are not designed for use as adatabase or a mass-storage device.
Applications use the profile functions in the Windows applicationprogramming interface (API) to save and retrieve initializationsettings. The following profile functions are used with WIN.INI:
GetProfileInt GetProfileString WriteProfileString
Until Windows version 3.0, applications stored their initializationdata in only one global place (WIN.INI). Windows version 3.0 added acomplimentary set of functions to the Windows API to enable anapplication to store its initialization data in a private INI file.These functions are as follows:
The following factors provided the motivation for the addition ofprivate INI files:
INI files are limited to 64K in size.
Windows ignores the portion of INI files past 64K. Therefore, if enough applications use WIN.INI rather than separate, private INI files, some of the user's INI data may be ignored.
No consistent way exists for users to remove old, unnecessary information from the WIN.INI file. Typically, when an application is removed from the system, the files are deleted from the application's directory. However, the corresponding information may not be deleted from WIN.INI. Alternately, if initialization data is stored in a private INI file in the application's directory or in a file with the application's name, the user is much more likely to delete the obsolete information.
Windows uses a linear search to find information in INI files. Therefore, smaller INI files provide faster performance.
By default, INI files are created in the Windows directory. However,an application should always use a fully qualified path to a differentdirectory because the Windows system directory is a shared resource ina Windows network setup.
Do not use the private profile functions with the WIN.INI file.Windows caches a copy of WIN.INI and one private INI file. Thiscaching scheme may be confused if WIN.INI is altered using the privateprofile functions.
Applications should use INI files conservatively. Use as few sectionsand as few lines as possible. For example, do not save the coordinatesof a window individually, as follows:
[window save pos] ul = 10 ur = 10 ll = 100 lr = 100
Instead, use one line, as follows:
[save_pos] window=10 10 100 100
This is a more efficient use of space and is much faster.