Reading the persistent values Miscellaneous Windows Vista (and later)
INIRead (Function)
In french: INILit
Reads the content of an INI file (or the content of a file structured like .INI files). You can get:
the value of a keyword found in a specific section, the list of keywords found in a section, the list of file sections. Example of .INI file
[WD examples] Name1 = WDInstall Name2 = WDBench [Description of WDInstall] Caption = Use the control panel of Windows LST = 43 Page = 12
nProduit is int = Val ( INIRead ( "USER" , ...
"LastProd" , "" , fExeDir ( ) + "\Port.INI" ) )
IF nProduit > 0 THEN ListSelectPlus ( LISTE_Produit , nProduit )
Syntax
<Result> = INIRead(<Section> [, <Keyword> [, <Not found> [, <File>]]])
<Result>: Character string
Text sought or list of keywords found in the section (the keywords are separated by CR characters), List of file sections (the sections are separated by CR characters). Content of <Not found> in the following cases:the string corresponding to the keyword is empty, the keyword is not found, the file is not found. Empty string (if <Not found> is not specified or if it is equal to an empty string) in the following cases:the string corresponding to the keyword is empty, the keyword is not found, the file is not found. <Section>: Character string
Name of section to read in the INI file. If this parameter and <Keyword> correspond to an empty string, <Result> contains the list of sections found in the file, separated by CR characters.Remark : This name cannot contain the character "-"..
<Keyword>: Optional character string
Name of the keyword containing the information to read. If this parameter is an empty string, <Result> contains the list of keywords found in <Section>, separated by CR characters.
<Not found>: Optional character string or optional integer
Text or integer to be returned if the requested keyword has not been read. This parameter corresponds to an empty string by default.
<File>: Optional character string
Full name of file to read (with its extension). The WIN.INI file will be used if this parameter is not specified. If only the name of the file is specified, the specified file will be searched for in the directory of Windows. Remarks
Reading the persistent values
Miscellaneous
To read the registry, use the registry-specific functions: RegistryQueryValue , ... INI files are limited to 64 KB. TSE : The INIRead function uses the Windows directory by default.. Note: Until version 21, the INIRead function used the user's Windows directory by default.. Reminder: In TSE mode, access to a '.INI' file with a relative name is not recommended. We advise you to use one of the following solutions: The RegistryXXX functions are not available. If the INI file contains data containing spaces, this data must be enclosed between quotes. For example: [MY SECTION] mydata = "My data containing spaces"
Business / UI classification: Business Logic
This page is also available for…