Gruppe
API
Problem
Wie kann ich den Wert "Strasse" aus der Abteilung "Data2" der Win.ini auslesen?
StandardModule: basMain
Declare Function GetProfileString Lib "kernel32" Alias _
"GetProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Sub Test()
MsgBox GetString("Desktop", "Wallpaper")
End Sub
Private Function GetString( _
Section As String, Key As String) As String
Dim lChr As Long
Dim sKey As String
sKey = String(256, 0)
lChr = GetProfileString(Section, Key, "", sKey, 256)
If lChr > 1 Then
sKey = Left(sKey, lChr)
End If
GetString = sKey
End Function