CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    What is the syntax of GetPrivateProfileInt ???? I always get an error on nDefault part...

    Thank You


  2. #2
    Join Date
    Jul 1999
    Posts
    17

    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


  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured