Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As LongPublic Function WriteOneString(ByVal Section As String, ByVal Key As String, ByVal Value As String, ByVal filen As String) As Boolean
 Dim X As Long, Buff As String * 128, i As Integer
 Buff = Value + Chr(0)
 X = WritePrivateProfileString(Section, Key, Buff, filen)
 WriteOneString = X
End Function
Public Function ReadOneString(ByVal Section As String, ByVal Key As String, ByVal filen As String) As String
 Dim X As Long, Buff As String * 128, i As Integer
 X = GetPrivateProfileString(Section, Key, "", Buff, 128, filen)
 i = InStr(Buff, Chr(0))
 ReadOneString = Trim(Left(Buff, i - 1))
End Function

解决方案 »

  1.   

    请你一试:
    先用上面neihh(haihua)所使用的API函数把要写入.INI文件的内容写入,之后调用FSO对象的相关属性和方法将.INI文件设置成隐藏文件,当然这一步也可以用API函数。
    另:手工建立.INI文件,并设置其属性为隐藏 ,之后再向其中写入信息。
      

  2.   

    隐藏是什么意思呢?
    如果是只是将ini文件隐藏,那么将ini文件的属性设为隐藏即可,不过好像没有什么实际的用处。
    我认为将ini文件里的信息用加密算法加密后写入,是一个比较实用的隐藏方法。