![]() |
|
| How to delete a INI-file section or key? | |
Declare the following:
Private Declare Function WritePrivateProfileString Lib "Kernel32" _ Alias "WritePrivateProfileStringA" (ByVal grpnm As String, _ ByVal parnm As Any, ByVal parvl As Any, _ ByVal INIPath As String) As LongThen use one of the following functions (untested!):
Public Sub INIDeleteGroup(INIPath As String, INIGroup As String) ' delete entire group from .INI file (physically) ' input: inipath=path to .INI file, INIGroup=group to delete Call WritePrivateProfileString(INIGroup, 0&, 0&, INIPath) End Sub Public Sub INIDeleteValue(INIPath As String, INIGroup As String, INIKey As String) ' delete line from .INI file (physically) ' input: inipath=path to .INI file, iniGroup=group header (no []), ' INIkey=parameter name Call WritePrivateProfileString(INIGroup, INIKey, 0&, INIPath) End Sub
|
|
| Mail to Daniel
Wiman <daniel@wimania.com> Online since June 1996, updated 990320 |
<- The VB home <- Daniels homepage |