VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get a string data from WIN.INI using GetProfileString API

by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 17th January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get a string data from WIN.INI using GetProfileString API

Rate Get a string data from WIN.INI using GetProfileString API



' Read the value "Wallpaper" from under the [Desktop] section  of WIN.INI.  If an error occurs, the function will return "Error" 
Dim wallpaper As String  ' receives string read from WIN.INI 
Dim slength As Long  ' receives length of string read from WIN.INI 
Dim buffer As String * 255 
' Read the string from WIN.INI 
slength = GetProfileString("Desktop", "Wallpaper", "Error", buffer, 255) 
wallpaper = Mid(buffer, 1, InStr(buffer, Chr(0)) - 1) ' extract the returned string from the buffer 
If wallpaper = "Error" Then 
MsgBox "Could not read information from WIN.INI." 
Else 
MsgBox "Current Wallpaper is " & wallpaper 
End If 
End 
End Sub

Download this snippet    Add to My Saved Code

Get a string data from WIN.INI using GetProfileString API Comments

No comments have been posted about Get a string data from WIN.INI using GetProfileString API. Why not be the first to post a comment about Get a string data from WIN.INI using GetProfileString API.

Post your comment

Subject:
Message:
0/1000 characters