Thank You
Printable View
Thank You
Hi,
The syntax is :
Public Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
where
lpApplicationName = Section name
lpKeyName = keyname
nDefault = default value
lpFileName = .ini file with the path.
Eg. if you have a file Reports.ini as below:
[Reports]
Print=1
and want to retrieve the value of Print, use the command as :
Msgbox GetPrivateProfileInt("Reports", "Print", -1, "c:\temp\Report.ini")
where -1 is teh default value.
Hope this helps you.
Regards,
Lalitha
You are using GetPrivateProfileInt, which means that the value returned is an integer (not VB integer, but long integer, that is a VB Long). Make sure the default value passed is a long, and not a string, if you need strings, use GetPrivateProfileString instead.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook