home *** CD-ROM | disk | FTP | other *** search
/ The Mother of All Windows Books / CD-MOM.iso / cd_mom / newsletr / vbz / vbz1-3 / ini.bas < prev    next >
BASIC Source File  |  1993-06-24  |  1KB  |  29 lines

  1. DefInt A-Z
  2.  
  3.  
  4. Declare Sub WritePrivateProfileString Lib "Kernel" (ByVal Section$, ByVal Entry$, ByVal Default$, ByVal IniFile$)
  5. Declare Function GetPrivateProfileString Lib "Kernel" (ByVal Section$, Entry As Any, Default As Any, ByVal Buff$, ByVal BuffLen, ByVal IniFile$)
  6.  
  7. Function GetIniLong& (IniFile$, Section$, Entry$, Default&)
  8.     GetIniLong& = Val(GetIniString$(IniFile$, Section$, Entry$, Format$(Default&)))
  9. End Function
  10.  
  11. Function GetIniString$ (IniFile$, Section$, Entry$, Default$)
  12.     Buff$ = Space$(255)
  13.     nChars = GetPrivateProfileString(Section$, ByVal Entry$, ByVal Default$, Buff$, 255, IniFile$)
  14.     If nChars > 0 Then
  15.         GetIniString$ = Left$(Buff$, nChars)
  16.     Else
  17.         GetIniString$ = ""
  18.     End If
  19. End Function
  20.  
  21. Sub SetIniLong (IniFile$, Section$, Entry$, Default&)
  22.     SetIniString IniFile$, Section$, Entry$, Format$(Default&)
  23. End Sub
  24.  
  25. Sub SetIniString (IniFile$, Section$, Entry$, Default$)
  26.     WritePrivateProfileString Section$, Entry$, Default$, IniFile$
  27. End Sub
  28.  
  29.