home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / rwini.zip / RWINI.BAS < prev    next >
BASIC Source File  |  1994-08-01  |  1KB  |  31 lines

  1. Option Explicit
  2. 'Read-Write INI Sample
  3. 'Written by: George Csefai-Keane, Inc.
  4. 'email: george.csefai@keaneinc.com
  5.  
  6. 'API Declarations
  7. Declare Function GetPrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
  8. Declare Function WritePrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lplFileName As String) As Integer
  9.  
  10. 'Variable Declarations
  11. Global r%       'Result Code from WritePrivateProfileString
  12. Global entry$   'Passed to WritePrivateProfileString
  13. Global iniPath$ 'Path to .ini file
  14.  
  15. Sub CenterForm (frm As Form)
  16.     frm.Top = (Screen.Height * .85) / 2 - frm.Height / 2
  17.     frm.Left = Screen.Width / 2 - frm.Width / 2
  18. End Sub
  19.  
  20. Function GetFromINI (AppName$, KeyName$, FileName$) As String
  21.    Dim RetStr As String
  22.    RetStr = String(255, Chr(0))
  23.    GetFromINI = Left(RetStr, GetPrivateProfileString(AppName$, ByVal KeyName$, "", RetStr, Len(RetStr), FileName$))
  24. End Function
  25.  
  26. Sub Main ()
  27.     CenterForm frmINI
  28.     frmINI.Show
  29. End Sub
  30.  
  31.