dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: read from an ini file

  1. #1
    kriptos Guest

    read from an ini file


    how can I read directly from an .ini file a specific value??

  2. #2
    Guest

    Re: read from an ini file


    "kriptos" <kriptos_77@hotmail.com> wrote:
    >
    >how can I read directly from an .ini file a specific value??


    Use the Win32 API.

    If you are saving/reading settings about your app, it's better use app.exe.config
    file. It is XML based, so more flexible.

    Joćo Ferreira

    www.visualbasicpt.com

  3. #3
    Russell Jones Guest

    Re: read from an ini file

    You can use Declare Function to declare the Win32 API
    GetPrivateProfileString. However, there are a few tricks to declaring the
    functions. First, you use a StringBuilder object rather than a String to
    pass a fixed-length buffer to unmanaged (the lpReturnedString parameter).
    Second, use a Byte array rather than a StringBuilder when the function
    returns a null-delimited lists of strings (such as the list returned using
    the GetPrivateProfileSection API call).

    "kriptos" <kriptos_77@hotmail.com> wrote in message
    news:3caaf117$1@10.1.10.29...
    >
    > how can I read directly from an .ini file a specific value??




  4. #4
    Eric Guest

    Re: read from an ini file


    Thanks for posting this. Every time I see someone ask this question on message
    boards, etc., people always just reply "use .config instead." It never seems
    to dawn on anyone that just MAYBE we are building a dotnet application that
    needs to edit INI files for another system that doesn't store its application
    data in .config files or the registry. Thanks again.

    "Russell Jones" <arj1@northstate.net> wrote:
    >You can use Declare Function to declare the Win32 API
    >GetPrivateProfileString. However, there are a few tricks to declaring the
    >functions. First, you use a StringBuilder object rather than a String to
    >pass a fixed-length buffer to unmanaged (the lpReturnedString parameter).
    >Second, use a Byte array rather than a StringBuilder when the function
    >returns a null-delimited lists of strings (such as the list returned using
    >the GetPrivateProfileSection API call).
    >
    >"kriptos" <kriptos_77@hotmail.com> wrote in message
    >news:3caaf117$1@10.1.10.29...
    >>
    >> how can I read directly from an .ini file a specific value??

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center