Declare Function WritePrivateProfileString Lib "kernel32.dll" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
lpApplicationName | The section of the INI file to write to. This is the name inside of brackets, but do not include the brackets in the parameter. |
lpKeyName | The name of the value to set. This is the name on the left side of the = sign. |
lpString | The string or integer value to write. This is what will appear on the right side of the = sign. |
lpFileName | The filename of the INI file to write to. |
'Edit the "scrnsave.exe" setting in the [boot] section of SYSTEM.INI
'(This assumes your Windows directory is C:\Windows)
'(NOTE: this is an example. It is best not to edit system files like this)
x = WritePrivateProfileString("boot", "scrnsave.exe", "C:\WINDOWS\SYSTEM\SCROLL~1.SCR", "c:\windows\system.ini")
Form1.Print "Screen saver set to Scrolling Marquee."
Declare Function WriteProfileString Lib "kernel32.dll" Alias "WriteProfileStringA" (ByVal lpszSection As String, ByVal lpszKeyName As String, ByVal lpszString As String) As Long
lpszSection | The section of WIN.INI to write to. This is the name inside of brackets, but do not include the brackets in the parameter. |
lpszKeyName | The name of the value to set. This is the name on the left side of the = sign. |
lpszString | The string or integer value to write. This is what will appear on the right side of the = sign. |
'Edit the "Wallpaper" setting in the [Desktop] section of WIN.INI
'(NOTE: this is an example. It is best not to edit system files like this)
x = WriteProfileString("Desktop", "Wallpaper", "C:\WINDOWS\CLOUDS.BMP")
Form1.Print "Wallpaper set to CLOUDS.BMP"
Paul Kuliniewicz
E-mail: Borg953@aol.com
All material presented on these pages is Copyright © Paul Kuliniewicz, except for other copyrighted material.
http://members.aol.com/Borg953/api/w.html