1.Of course. 2.Use GetPrivateProfileString function
Private Declare Function GetPrivateProfileString Lib "kernel32" C:\test.ini的内容 [Section1] Key1=hello程序 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 Private Sub Form_Load() dim NC as long dim Ret as String Ret=space(255) NC = GetPrivateProfileString("Section1", "Key1", "Default", Ret, 255, "C:\test.ini") If NC <> 0 Then Ret = Left$(Ret, NC) MsgBox Ret End Sub
2.Use GetPrivateProfileString function
C:\test.ini的内容
[Section1]
Key1=hello程序
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
Private Sub Form_Load()
dim NC as long
dim Ret as String
Ret=space(255)
NC = GetPrivateProfileString("Section1", "Key1", "Default", Ret, 255, "C:\test.ini")
If NC <> 0 Then Ret = Left$(Ret, NC)
MsgBox Ret
End Sub
至于总共多长,没有限制的。
第二个问题,他们解决的很好的。