1.字符串的连接操作:
Dim g_strIniPath As String
g_strIniPath = App.Path & "/" & "VideoInfo.ini"
2.对ini文件的操作:
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
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
写ini文件:
Call WritePrivateProfileString("VideoInfo", "lVideoStandard", g_strVideoStandard, g_strIniPath)
读ini文件:
Public Sub ReadString()
Dim ret As Long
Dim buff As String
buff = String(255, 0)
ret = GetPrivateProfileString("VideoInfo ", "lVideoStandard", "PAL", buff, 256, g_strIniPath)
If CDbl(ret) = -1 Then
g_strVideoStandard = "PAL"
Else
g_strVideoStandard = buff
End If
Call MsgBox(g_strVideoStandard)
End Sub
3.Option控件的使用和字符串的比较:
Private Sub OptNtsc_Click()
g_strVideoStandard = "NTSC"
Call SDK30001.SetVideoStandard(1)
End Sub
Private Sub OptPal_Click()
g_strVideoStandard = "PAL"
Call SDK30001.SetVideoStandard(32)
End Sub
If StrComp(g_strVideoStandard, "PAL", 1) = 0 Then
MsgBox ("PPPPPPPP")
'lVideoStandard = 32
'OptPal.Value = True
'OptNtsc.Value = False
ElseIf StrComp(g_strVideoStandard, "NTSC", 1) = 0 Then
MsgBox ("NNNNNNNNN")
'lVideoStandard = 1
'OptNtsc.Value = True
'OptPal.Value = False
End If