PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Writing into a INI file in Unicode mode
  • 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
Writes a specific value into an INI file (or into a file structured like an .INI file). You can:
  • write the value of a keyword found in a specific section,
  • create or delete a keyword,
  • create or delete a section.
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
// Store the selected product in the .INI
INIWrite("USER", "LastProd", ...
NumToString(ListSelect(LIST_Product)), ...
fCurrentDir() + "\Port.INI")
WINDEVWEBDEV - Server codeReports and QueriesWindows MobilePHPAjaxUser code (UMC)
Example of .INI file:
[WD examples]
Name1 = WDInstall
Name2 = WDBench
[Description of WDInstall]
Caption = Use the control panel of Windows
LST = 43
Page = 12
// Write into the [WD examples] section
INIWrite("WD examples", "Name3", "WDExample", "C:\Temp\ExamplesLST.INI")
Syntax
<Result> = INIWrite(<Section> [, <Keyword> [, <Value> [, <File>]]])
<Result>: Boolean
  • True if the operation was performed,
  • False otherwise.
<Section>: Character string (with quotes)
Name of section where the write operation will be performed. The section is automatically created if it does not exist.
Note: This name cannot contain the "-" character.
<Keyword>: Optional character string (with quotes)
Name of keyword containing the information to write. This keyword s automatically created if it does not exist.
The section will be deleted if this parameter is an empty string ("") or if it corresponds to NULL.
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.
<Value>: Optional character string (with quotes)
Text to write for the keyword and the specified section. The keyword will be deleted if this parameter is an empty string ("") or if ti corresponds to NULL.
Note: This name cannot contain the TAB character.
PHP This name cannot contain the quotation mark 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.
<File>: Optional character string (with quotes)
Full name of file to complete (with its extension).
  • The WIN.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 Windows directory.
  • The directory will not be created if it does not exist.
  • The file will be created if it does not exist in the specified directory.
Windows Mobile Full name of file to fill (with its extension). The file will be created if it does not exist.
Java Full name of file to complete (with its extension).
  • 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. 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 file to complete (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 file to complete (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 file to complete (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 Full name of file to complete (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 Full name of file to complete (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 Full name of file to complete (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 file to fill (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. The file will be created if it does not exist.
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
Versions 17 and later

Writing into a INI file in Unicode mode

Your application operates in Unicode mode ("Use UNICODE strings at run time" checked in the "Unicode" tab of the configuration description).
In this case, to write into an INI file, this INI file must be in Unicode format, which means that it must have a Unicode BOM header.
Example:
fCreate(gsINIFile, foUnicode) // creates gsINIFile with BOM UNICODE
INIWrite("French", "Country", "French",gsINIFile)
INIWrite("中国","国家", "中国", gsINIFile)
New in version 17

Writing into a INI file in Unicode mode

Your application operates in Unicode mode ("Use UNICODE strings at run time" checked in the "Unicode" tab of the configuration description).
In this case, to write into an INI file, this INI file must be in Unicode format, which means that it must have a Unicode BOM header.
Example:
fCreate(gsINIFile, foUnicode) // creates gsINIFile with BOM UNICODE
INIWrite("French", "Country", "French",gsINIFile)
INIWrite("中国","国家", "中国", gsINIFile)

Writing into a INI file in Unicode mode

Your application operates in Unicode mode ("Use UNICODE strings at run time" checked in the "Unicode" tab of the configuration description).
In this case, to write into an INI file, this INI file must be in Unicode format, which means that it must have a Unicode BOM header.
Example:
fCreate(gsINIFile, foUnicode) // creates gsINIFile with BOM UNICODE
INIWrite("French", "Country", "French",gsINIFile)
INIWrite("中国","国家", "中国", gsINIFile)

Various

  • We do not advise you to write into the WIN.INI file.
  • To write into the registry, use the functions specific to the registry: RegistrySetValue, etc.
  • The INI files are limited to 64 KB (in Windows 98).
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
Click [Add] to post a comment