如何如何读取ini 文件啊~
比如我的ini 文件类容是[Info]
Skin=娱乐[Title]
TitleBarFlag=1
TitleBarWH=100,25
TitleBarLT=0,0
怎么读取到Skin=娱乐 这行里的 娱乐两个字啊~ 又该如何用Command控件 修改 娱乐 这两个字啊在程序里~ 各位大哥大姐 帮忙解决下哦 谢谢了~~~~
比如我的ini 文件类容是[Info]
Skin=娱乐[Title]
TitleBarFlag=1
TitleBarWH=100,25
TitleBarLT=0,0
怎么读取到Skin=娱乐 这行里的 娱乐两个字啊~ 又该如何用Command控件 修改 娱乐 这两个字啊在程序里~ 各位大哥大姐 帮忙解决下哦 谢谢了~~~~
http://community.csdn.net/Expert/topic/4944/4944354.xml?temp=.5238916
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Integer, _
ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias _
"WritePrivateProfileStringA" (ByVal Appname As String, _
ByVal KeyName As Any, ByVal NewString As Any, _
ByVal Filename As String) As LongPublic Function ReadIni(lpSectionName As String, lpKeyName As String, _
lpDefault As String, lpFileName As String) As String
Dim X As Long
Dim Temp As String * 50
X = GetPrivateProfileString(lpSectionName, lpKeyName, lpDefault, _
Temp, Len(Temp), lpFileName) If X = 0 Then
Beep
Else
ReadIni = Trim(Temp)
End If
End Function
Public Sub WriteIni(lpSectionName As String, lpKeyName As String, _
lpValue As String, lpFileName As String, lpDelAsk As Boolean)
If lpDelAsk Then
Dim r As Long
If lpKeyName = "" Then
r = MsgBox("Are you sure want to delete the Section """ & _
lpSectionName & """ ?", vbOKCancel, "Warning!")
If r = vbCancel Then
Exit Sub
End If
ElseIf lpValue = "" Then
r = MsgBox("Are you sure want to delete the Key """ & _
lpKeyName & """ ?", vbOKCancel, "Warning!")
If r = vbCancel Then
Exit Sub
End If
End If
End If
Dim U As Long
U = WritePrivateProfileString(lpSectionName, lpKeyName, lpValue, lpFileName)
If U = 0 Then
Beep
End If
End Sub读取:
ReadIni "Info", "Skin", "默认", App.Path & "\info.ini"
......................................