Read/Write .INI File Routine? 
Author Message
 Read/Write .INI File Routine?

Does anyone have a sample routine to read and write to/from a
config file on disk such as a .INI file?


Thu, 20 May 2004 04:37:06 GMT  
 Read/Write .INI File Routine?
' Sub ini
'---------

'Declaraties
Public Declare Function GetPrivateProfileString Lib _
"kernel32" Alias "GetPrivateProfileStringA" (ByVal _
lpApplicationName As String, ByVal lpKeyName As String, _
ByVal lpDefault As String, ByVal lpReturnedString As String, _
ByVal nSize As Long, ByVal lpFileName As String) As Long

Public 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

Public Function ReadINI(strsection As String, strkey As String, strfullpath
As String) As String
   Dim strbuffer As String
   Let strbuffer$ = String$(750, Chr$(0&))
   Let ReadINI$ = Left$(strbuffer$, GetPrivateProfileString(strsection$,
ByVal LCase$(strkey$), "", strbuffer, Len(strbuffer), strfullpath$))
End Function

Public Sub WriteINI(strsection As String, strkey As String, strkeyvalue As
String, strfullpath As String)
   Call WritePrivateProfileString(strsection$, UCase$(strkey$),
strkeyvalue$, strfullpath$)
End Sub

ReadINI("Instellingen", "theater",App.path &"\setting.ini")
Call WriteINI("Instellingen", "theater", atheater, locatie)

Geert



Quote:
> Does anyone have a sample routine to read and write to/from a
> config file on disk such as a .INI file?



Mon, 31 May 2004 22:09:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Qbasic: Pre-written INI read/write routines?

2. Read/Write INI Files w/Access 7.0

3. Ini-file, read write and empty lines.

4. Reading and writing from and to ini files

5. read/write an .ini file

6. Reading and writing to an INI file?

7. Reading and Writing to .ini files - help please.

8. Read and Write to INI files

9. Reading/writing to an INI file

10. Reading / Writing an INI file

11. Reading / Writing an INI file

12. How to read and write an ini file with Qbasic 4.5

 

 
Powered by phpBB® Forum Software