【www.gdgbn.com--php常用代码】

                                        

Module1.bas代码:


Option Explicit

Private strINI As String
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


Private Sub CreateIni(strDrv As String, strDir As String)
strINI = MakePath(strDrv, strDir)
End Sub

Public Sub WriteIniKey(strSection As String, strKey As String, strValue As String)
WritePrivateProfileString strSection, strKey, strValue, strINI
End Sub

Public Function GetIniKey(strSection As String, strKey As String) As String
Const myinifile = "Info.ini"
strINI = myinifile
Dim strTmp As String
Dim lngRet As String
Dim i As Integer
Dim strTmp2 As String

strTmp = String$(1024, Chr(32))
lngRet = GetPrivateProfileString(strSection, strKey, "", strTmp, Len(strTmp), strINI)
strTmp = Trim(strTmp)
strTmp2 = ""
F

本文来源:http://www.gdgbn.com/jiaocheng/13018/