可不可以增加或删除ini的段和键

解决方案 »

  1.   

    可以啊
    http://download.csdn.net/source/1025864
    这里面有两个小程序可以直接对win.ini进行增加和删除的
    我都没积分发布问题了,别忘了把积分给我哦,谢谢了
      

  2.   

    摘自我的程序的一段代码,符合楼主你的要求。其中“App.Path & "\" & ProfileName”是ini文件的路径。'删除INI文件键
    Public Function DeleteProfileKey(ByVal sKey As String, ByVal sSection As String) As Boolean
        Dim fRtn As Boolean
        
        fRtn = WritePrivateProfileString(sSection, sKey, vbEmpty, App.Path & "\" & ProfileName)
        DeleteProfileKey = fRtn
    End Function'删除INI文件段
    Public Function DeleteProfileSection(ByVal sSection As String) As Boolean
         Dim fRtn As Boolean
         
         fRtn = WritePrivateProfileString(sSection, vbEmpty, vbEmpty, App.Path & "\" & ProfileName)
         DeleteProfileSection = fRtn
    End Function