Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private 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 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'写INI文件 Private Sub Command1_Click() Dim Counter As Long For Counter = 1 To 4 Call WriteToIni(App.Path & "\Options.ini", "Test", "Name" & Counter, "Value" & Counter) Next Counter End Sub'读INI文件 Private Sub Command2_Click() Dim Counter As Long Dim Value(3) As String For Counter = 1 To 4 Value(Counter - 1) = ReadFromIni(App.Path & "\Options.ini", "Test", "Name" & Counter) Next Counter End Sub
Private 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
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'写INI文件
Private Sub Command1_Click()
Dim Counter As Long For Counter = 1 To 4
Call WriteToIni(App.Path & "\Options.ini", "Test", "Name" & Counter, "Value" & Counter)
Next Counter
End Sub'读INI文件
Private Sub Command2_Click()
Dim Counter As Long
Dim Value(3) As String For Counter = 1 To 4
Value(Counter - 1) = ReadFromIni(App.Path & "\Options.ini", "Test", "Name" & Counter)
Next Counter
End Sub