PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Reading the persistent values
  • Various
  • Windows Vista (and later)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Reads the content of a INI file (or the content of a file structured like a .INI file). 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.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example of .INI file
[WD examples]
Name1 = WDInstall
Name2 = WDBench
[Description of WDInstall]
Caption = Use the control panel of Windows
LST = 43
Page = 12
WINDEVWEBDEV - Server codeReports and QueriesWindows MobilePHPAjaxUser code (UMC)
// Read in the [WD Examples] section
INIRead("WD Examples", "Name2", "", "C:\Temp\ExamplesLST.INI")
// Default choice read in the .INI
nProduct is int = Val(INIRead("USER", ...
"LastProd", "", fExeDir() + "\Port.INI"))
IF nProduct > 0 THEN ListSelectPlus(LIST_Product, nProduct)
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 (with quotes)
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.

Note: This name cannot contain the "-" character.
Versions 17 and later
iPhone/iPad This parameter must necessarily be specified.
New in version 17
iPhone/iPad This parameter must necessarily be specified.
iPhone/iPad This parameter must necessarily be specified.
<Keyword>: Optional character string (with quotes)
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.
Versions 17 and later
iPhone/iPad This parameter must necessarily be specified.
New in version 17
iPhone/iPad This parameter must necessarily be specified.
iPhone/iPad This parameter must necessarily be specified.
<Not Found>: Optional character string (with quotes)
Text to return if the requested keyword was not read. This parameter corresponds to an empty string by default.
Versions 17 and later
iPhone/iPad This parameter must necessarily be specified.
New in version 17
iPhone/iPad This parameter must necessarily be specified.
iPhone/iPad This parameter must necessarily be specified.
<File>: Optional character string (with quotes)
Full name of the 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 sought in the directory of Windows.
Windows Mobile Name and full path of the file to read (with its extension).
Java Full name of the file to read (with its extension).
  • If this parameter is not specified, the file used will be the one named as the project and found in the runtime directory of the application.
  • The file will be created if it does not exist.
  • If only the path is not specified , the file will be sought in the runtime directory of the application.
Versions 15 and later
AndroidAndroid Widget Full name of the file to read (with its extension). This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
  • If this parameter is not specified, the file used will be the one named like the project and found in the runtime directory of the application (current directory). The file will be created if it does not exist.
  • If only the path is not specified , the file will be sought in the runtime directory of the application (current directory).
Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
New in version 15
AndroidAndroid Widget Full name of the file to read (with its extension). This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
  • If this parameter is not specified, the file used will be the one named like the project and found in the runtime directory of the application (current directory). The file will be created if it does not exist.
  • If only the path is not specified , the file will be sought in the runtime directory of the application (current directory).
Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
AndroidAndroid Widget Full name of the file to read (with its extension). This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
  • If this parameter is not specified, the file used will be the one named like the project and found in the runtime directory of the application (current directory). The file will be created if it does not exist.
  • If only the path is not specified , the file will be sought in the runtime directory of the application (current directory).
Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
Versions 16 and later
Universal Windows 10 App Windows Phone: Full name of the file to read (with its extension). The file path corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
  • If this parameter is not specified, the file used will be the one named like the project and found in the runtime directory of the application (data directory). The file will be created if it does not exist.
  • If only the path is not specified , the file will be sought in the runtime directory of application (data directory).
Reminder: In Windows Phone, only the files found in the data directory associated with the application can be handled.
New in version 16
Universal Windows 10 App Windows Phone: Full name of the file to read (with its extension). The file path corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
  • If this parameter is not specified, the file used will be the one named like the project and found in the runtime directory of the application (data directory). The file will be created if it does not exist.
  • If only the path is not specified , the file will be sought in the runtime directory of application (data directory).
Reminder: In Windows Phone, only the files found in the data directory associated with the application can be handled.
Universal Windows 10 App Windows Phone: Full name of the file to read (with its extension). The file path corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
  • If this parameter is not specified, the file used will be the one named like the project and found in the runtime directory of the application (data directory). The file will be created if it does not exist.
  • If only the path is not specified , the file will be sought in the runtime directory of application (data directory).
Reminder: In Windows Phone, only the files found in the data directory associated with the application can be handled.
PHP Full name of the file to read (with its extension). The PHP.INI file will be used if this parameter is not specified. If only the path is not specified , the file will be sought in the current directory.
Linux Full name of the file to read (with its extension). The .PCS.conf file will be used if this parameter is not specified (this file must be found in the home directory of the user). If only the path is not specified , the file will be sought in the home directory of the user.
Versions 17 and later
iPhone/iPad This parameter is mandatory. This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, an application has the rights to write into its setup directory or into one of its sub-directories.
New in version 17
iPhone/iPad This parameter is mandatory. This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, an application has the rights to write into its setup directory or into one of its sub-directories.
iPhone/iPad This parameter is mandatory. This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, an application has the rights to write into its setup directory or into one of its sub-directories.
Remarks

Reading the persistent values

To read the persistent values in a INI file (saved by SaveParameter), use LoadParameter.

Various

  • To read in the registry, use the functions specific to the registry: RegistryQueryValue, ...
  • The INI files are limited to 64 KB (in Windows 98).
  • TSE: INIRead is using the Windows directory of the user by default.TSE: INIRead is using the Windows directory by default.
    Caution: Until version 21, INIRead was using the Windows directory of the user by default.
    Reminder: In TSE mode, the access to a '.INI' file with a relative name is not recommended. We advise you to use one of the following solutions:
  • PHP The RegistryXXX functions are not available.
  • PHP If the INI file contains data containing spaces, this data must be enclosed between quotes. For example:
    [MY SECTION]
    mydata = "My data containing spaces"
WINDEVReports and QueriesUser code (UMC)

Windows Vista (and later)

The programming standards of Windows do not advise you to write:
  • into the WIN.INI file,
  • into the system directories (Windows directory, "Program Files" directory, ...).
In Windows Vista (and later) with the UAC mechanism enabled, the administrator privileges are required to perform these operations. If the application does not have the required administrator privileges, the UAC mechanism will redirect the files (called virtualization) to a directory specific to the user who is using the application (C:\Users\<LOGIN>AppData\Local\VirtualStore\Windows\). The files can be read again by INIRead used in the same application. This virtualization mechanism of files is proposed by Windows Vista (and later) for compatibility and it is not available in 64 bits.
Caution: If the INI file is automatically virtualized by Windows Vista (and later), the INI file cannot be shared between several applications (especially if these applications use different privileges).
Programming tip: To create a INI file without having the administrator privileges:
  • do not use the WIN.INI file (the <File> parameter must be specified)
  • avoid writing into the Windows directory or into the "Program Files" directory,
  • use the system directory corresponding to the application (returned by SysDir associated with the srCommonAppData constant).
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
LER CAMPOS INI E TXT
EDT_Retorno_cStat=INIRead("EVENTO001","cStat","",EDT_localizacao_arquivo_retorno_carta)
EDT_Retorno_nProt=INIRead("EVENTO001","nProt","",EDT_localizacao_arquivo_retorno_carta)
//===
[EVENTO001]
cStat=135
//BLOG COM VIDE E EXEMPLO

AULA 1312 WINDEV DICAS 048 INIREAD

http://windevdesenvolvimento.blogspot.com.br/2017/12/aula-1312-windev-dicas-048-iniread.html

https://www.youtube.com/watch?v=5F7zQU9sBYQ
De matos
Dec. 22 2017