|
-
December 4th, 1999, 12:12 AM
#1
What is the syntax of GetPrivateProfileInt ???? I always get an error on nDefault part...
-
October 23rd, 2001, 02:01 AM
#2
Re: What is the syntax of GetPrivateProfileInt ???? I always get an error on nDefault part...
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
-
October 23rd, 2001, 02:10 AM
#3
Re: What is the syntax of GetPrivateProfileInt ???? I always get an error on nDefault part...
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|