Windows API Guide: GetDoubleClickTime Function


Declare Function GetPrivateProfileString Lib "kernel32.dll" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Platforms: Win 32s, Win 95/98, Win NT

GetPrivateProfileString reads an string value from an INI file. The parameters passed to the function specify which value will be read from. The function always returns the length in characters of the string put into the variable passed as lpReturnedString. If the function was successful, the string read from the INI file will be put into lpReturnedString. If not, it will instead receive the string given as lpDefault. Note that INI file support is only provided in Windows for backwards compatibility; using the registry to store information is preferred.

lpApplicationName
The header of the INI file section the value is in.
lpKeyName
The name of the value to read.
lpDefault
The value to return if a valid value cannot be read. Make it something that would definitely not be read, such as "(error)".
lpReturnedString
A fixed-length string that will receive either the string read from the file or lpDefault.
nSize
The length in characters of lpReturnedString.
lpFileName
The filename of the INI file to read from.

Example:

' Read the "username" value under the [default] section of ' the INI file C:\MyProgram\config.ini.  The default value is "anonymous". Dim uname As String  ' receives the value read from the INI file Dim slength As Long  ' receives length of the returned string uname = Space(255)  ' provide enough room for the function to put the value into the buffer ' Read from the INI file slength = GetPrivateProfileString("default", "username", "anonymous", uname, 255, "C:\MyProgram\config.ini") uname = Left(uname, slength)  ' extract the returned string from the buffer Debug.Print "User's name: "; uname

See Also: GetPrivateProfileInt, GetProfileString, WritePrivateProfileString
Category: INI Files

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/g/getprivateprofilestring.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net