文本文件格式如:
------------------
[公司名称]
星星软件有限公司
[公司地址]
福建省福州市..-----------------接下来VB中如何调用这些参数?

解决方案 »

  1.   

    ini文件的格式[Market]
    Name=aaa读取函数:
    MarketName = ReadFromIni(App.Path + "\Option.ini", "Market", "Name")
    Public Function ReadFromIni(ByVal Filename As String, ByVal Section As String, ByVal key As String) As String
        Dim I As Long
        Dim buff As String * 128
        GetPrivateProfileString Section, key, "", buff, 128, Filename
        I = InStr(buff, Chr(0))
        ReadFromIni = Trim(Left(buff, I - 1))
    End Function
      

  2.   

    报错:子程序或函数未定义。GetPrivateProfileString
      

  3.   

    wsheep() 假如我文字的内容里有包含[]符号呢?
      

  4.   

    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 Long不好意思,忘记贴这个了
      

  5.   

    原来你漏写了个API函数。
    难怪不行。
    Private 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 Long现在解决了。谢谢大家。
      

  6.   

    有现成的类 你要吗 把email告诉我
      

  7.   

    [email protected]我想要可以换行的。
      

  8.   

    [CompuerName]
    Name=我的
    电脑-------------
    如果这样,它只认到“我的”
      

  9.   

    给我也发一个:  [email protected]
      

  10.   

    给我也发一个:  [email protected]
    thanks