home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD94308302000.psc / INI.cls < prev    next >
Encoding:
Visual Basic class definition  |  2000-08-30  |  1.5 KB  |  44 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "INI"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. ' Declarations
  15. 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
  16. 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
  17.  
  18. ' Module wide variables
  19. Private INIFileName As String
  20. Private Ret As String
  21. '
  22.  
  23. Public Function ReadINI(Section As String, Key As String) As Variant
  24. Ret = Space$(255)
  25. RetLen = GetPrivateProfileString(Section, Key, "", Ret, Len(Ret), INIFileName)
  26. Ret = Left$(Ret, RetLen)
  27. ReadINI = Ret
  28.  
  29. End Function
  30.  
  31. Public Sub WriteINI(Section As String, Key As String, Text As String)
  32. WritePrivateProfileString Section, Key, Text, INIFileName
  33. End Sub
  34.  
  35. Public Property Get inifile() As String
  36.     inifile = INIFileName
  37. End Property
  38.  
  39. Public Property Let inifile(ByVal vNewValue As String)
  40.     INIFileName = vNewValue
  41. End Property
  42.  
  43.  
  44.