3.9 Initialization-File Functions

Initialization-file functions obtain information from and copy information to the Windows initialization file WIN.INI and private initialization files. A Windows initialization file is a special ASCII file that contains key-name–value pairs that represent run-time options for applications. The following list briefly describes each initialization-file function:

Function Description  
GetPrivateProfileInt Returns an integer value in a section from a private initialization file.  
GetPrivateProfileString Returns a character string in a section from a private initialization file.  
GetProfileInt Returns an integer value in a section from the WIN.INI file.  
GetProfileString Returns a character string in a section from the WIN.INI file.  
WritePrivateProfileString Copies a character string to a private initialization file, or deletes one or more lines in a private initialization file.  
WriteProfileString Copies a character string to the WIN.INI file, or deletes one or more lines from WIN.INI.  

An application should use a private (application-specific) initialization file to record information which affects only that application. This improves both the performance of the application and Windows itself by reducing the amount of information that Windows must read when it accesses the initialization file. An application should record information in WIN.INI only if it affects the Windows environment or other applications; in such cases, the application should send the WM_WININICHANGE message to all top-level windows.

The files WININI.TXT and SYSINI.TXT supplied with the retail version of Windows describe the contents of WIN.INI and SYSTEM.INI, respectively.