VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get a string data from an INI file using GetPrivateProfileString 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 an INI file using GetPrivateProfileString API

Rate Get a string data from an INI file using GetPrivateProfileString API



' Read the "email" value under the [ReleaseSoft] section of 
' the INI file G:\myagent.ini. 
Dim mymail As String  ' receives the value read from the INI file 
Dim slength As Long  ' receives length of the returned string 
mymail = Space(255)  ' provide enough room for the function to put the value into the buffer 
' Read from the INI file 
slength = GetPrivateProfileString("ReleaseSoft", "email", "-1", mymail, 255, "G:\myagent.ini") 
mymail = Left(mymail, slength)  ' extract the returned string from the buffer 
If mymail <> "-1" Then 
MsgBox "Mail ID is  " & mymail 
Else 
MsgBox "Data not found" 
End If 
End 
End Sub

Download this snippet    Add to My Saved Code

Get a string data from an INI file using GetPrivateProfileString API Comments

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

Post your comment

Subject:
Message:
0/1000 characters