怎么样删除INI文件下的内容?
如果我想把ini文件中的某个特定的section下面的key&value都删除调.
如果不能用api,有什么办法.
例:
[section]
key=value1
[section1]
newkey=newvalue
想删除
newkey=newvalue
[解决办法]
Private Declare Function GetPrivateProfileString Lib "kernel32 " Alias "GetPrivateProfileStringA " (ByVal lpApplicationName As String, lpKeyName As Any, ByVal lpDefault As String, ByVal lpRetunedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32 " Alias "WritePrivateProfileStringA " (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lplFileName As String) As Long
Private R As Long
Private iStr As String
Private FilePath As String
Public Function WriteIni(AppName As String, KeyName As String, InString As String, FilePath As String) As String
iStr = InString
R = WritePrivateProfileString(AppName, KeyName, InString, FilePath)
If R <> 1 Then Debug.Print "Write Err! "
End Function
call writeini( "section1 ", "newkey ",vbnullstring, "c:\1.ini ")