Advertisement
1_2002 Files/ File Controls/ Input/ Output #106137

all Ini Functions activeX.dll

Performs all ini file functions from within a single dll file.

AI

Yapay Zeka Özeti: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kaynak Kod
original-source
Public m_MstrConfigName As String
Dim m_strKeyname As String
Dim m_strsection As String
Dim m_strKeyValue As String
Dim m_strdefault As String
Private Sub Class_Initialize()
m_MstrConfigName = App.Path & "\ Your Ini file name"
End Sub

Public Property Get KeyName() As String
End Property
Public Property Let KeyName(ByVal strNewValue As String)
End Property
Public Function KeyGet(Optional strSection As String = "N/A", Optional strKeyName = "N/A", Optional strdefault As String = "")
Dim lngRet As Long
'fill in section
If strSection <> "N/A" Then
  m_strsection = strSection
End If
If strKeyName <> "N/A" Then
  m_strKeyname = strKeyName
End If
m_strdefault = strdefault
'get value
m_strKeyValue = Space(255)
lngRet = GetPrivateProfileString(m_strsection, _
                 m_strKeyname, _
                 m_strdefault, _
                 m_strKeyValue, _
                 Len(m_strKeyValue), _
                 m_MstrConfigName)
                 
If lngRet > 0 Then
  m_strKeyValue = Left$(m_strKeyValue, lngRet)
  Else
    m_strKeyValue = vbNullString
End If
 KeyGet = m_strKeyValue
                
End Function
Public Sub Keysave(Optional strSection As String = "N/A", Optional strKeyName = "N/A", Optional strdefault As String = "")
Dim lngRet As Long
'fill in properties
If strSection <> "N/A" Then
  m_strsection = strSection
End If
If strKeyName <> "N/A" Then
  m_strKeyname = strKeyName
End If

'get value
m_strKeyValue = Space(255)
lngRet = WritePrivateProfileString(m_strsection, _
                 m_strKeyname, _
                 m_strKeyValue, _
                 m_MstrConfigName)
                 
End Sub
Public Function SectionGet(Optional strSection As String = "") As Variant
Dim lngRet As Long
Dim strBuffer As String
If Not strSection = vbNullString Then
  m_strsection = strSection
  End If
  
If Not m_strsection = vbNullString Then
  strBuffer = Space(2048)
  
  lngRet = GetPrivateProfileSection(m_strsection, _
                  strBuffer, _
                  Len(strBuffer), _
                  m_MstrConfigName)
 End If
If lngRet > 0 Then
  strBuffer = Left$(strBuffer, lngRet)
  SectionGet = Split(strBuffer, Chr$(0))
  Else
    SectionGet = Array()
End If
End Function
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı