Api in C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Weimin Zhang

    Api in C#

    I would like to access my ini file from C#, but looks
    like C# doesn't support the Api function,
    GetPrivateProfi leString() which I used to read from an
    ini file in VS 6. Is there anyway to use this function,
    or other ways to access an ini file from C#? Thanks.
  • Daniel F. Devine

    #2
    Re: Api in C#


    "Weimin Zhang" <wzhang@stssyst ems.com> wrote in message
    news:002c01c378 78$540f66d0$a30 1280a@phx.gbl.. .[color=blue]
    > I would like to access my ini file from C#, but looks
    > like C# doesn't support the Api function,
    > GetPrivateProfi leString() which I used to read from an
    > ini file in VS 6. Is there anyway to use this function,
    > or other ways to access an ini file from C#? Thanks.[/color]


    Whilst Microsoft recommends using XML now - some of us still need to support
    ini file for legacy reasons. You can use PInvoke and the Kernal.dll to gain
    access to GetPrivateProfi leString()



    Comment

    • Pieter Philippaerts

      #3
      Re: Api in C#

      "Weimin Zhang" <wzhang@stssyst ems.com> wrote[color=blue]
      > I would like to access my ini file from C#, but looks
      > like C# doesn't support the Api function,
      > GetPrivateProfi leString() which I used to read from an
      > ini file in VS 6. Is there anyway to use this function,
      > or other ways to access an ini file from C#? Thanks.[/color]

      Take a look at http://www.mentalis.org/soft/class.qpx?id=6
      It's a wrapper around the GetPrivatProfil eString and
      WritePrivatePro fileString functions.

      Regards,
      Pieter Philippaerts
      Managed SSL/TLS: http://www.mentalis.org/go.php?sl


      Comment

      • Weimin Zhang

        #4
        Re: Api in C#

        Thanks.

        The dll is called kernel32.dll.[color=blue]
        >-----Original Message-----
        >
        >"Weimin Zhang" <wzhang@stssyst ems.com> wrote in message
        >news:002c01c37 878$540f66d0$a3 01280a@phx.gbl. ..[color=green]
        >> I would like to access my ini file from C#, but looks
        >> like C# doesn't support the Api function,
        >> GetPrivateProfi leString() which I used to read from an
        >> ini file in VS 6. Is there anyway to use this function,
        >> or other ways to access an ini file from C#? Thanks.[/color]
        >
        >
        >Whilst Microsoft recommends using XML now - some of us[/color]
        still need to support[color=blue]
        >ini file for legacy reasons. You can use PInvoke and[/color]
        the Kernal.dll to gain[color=blue]
        >access to GetPrivateProfi leString()
        >
        >
        >
        >.
        >[/color]

        Comment

        Working...