#Define WIN_INCLUDEALL
#Include Once "windows.bi"
#Include Once "win/commdlg.bi"
#Define DefaultGroup Mid(Command(0), InstrRev(Command(0), "\") + 1) ' Standardgruppe, wenn kein Gruppenname übergeben wird. In diesem Beispiel entspricht sie dem Namen der EXE-Datei.

' INI-Einstellungen (Deklarationen können auch gerne durch ein einfaches #include "windows.bi" ersetzt werden)
Declare Function GetPrivateProfileStringB 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
Declare Function WritePrivateProfileStringB Lib "kernel32" Alias "WritePrivateProfileStringA" (Byval lpApplicationName As String, Byval lpKeyName As String, Byval lpString As String, Byval lpFileName As String) As Long

'Benötigte Funktionen
Function GetValue(Key As String, Default As String = "", Group As String = DefaultGroup, Filename As String = Command(0) + ".ini") As String
    Dim TmpRetStr As String * 1280
    Dim RetVal As Long
    RetVal = GetPrivateProfileStringB(Group, Key, Default & Chr(0), TmpRetStr, Len(TmpRetStr), Filename)
    Return Left(TmpRetStr, RetVal)
End Function

Sub SetValue(Key As String, Value As String, Group As String = DefaultGroup, Filename As String = Command(0) + ".ini")
    WritePrivateProfileStringB Group, Key, Value, Filename
End Sub