Api in C#

W

Weimin Zhang

I would like to access my ini file from C#, but looks
like C# doesn't support the Api function,
GetPrivateProfileString() 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.
 
D

Daniel F. Devine

Weimin Zhang said:
I would like to access my ini file from C#, but looks
like C# doesn't support the Api function,
GetPrivateProfileString() 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.


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 GetPrivateProfileString()
 
P

Pieter Philippaerts

Weimin Zhang said:
I would like to access my ini file from C#, but looks
like C# doesn't support the Api function,
GetPrivateProfileString() 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.

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

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

Weimin Zhang

Thanks.

The dll is called kernel32.dll.
-----Original Message-----




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 GetPrivateProfileString()



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top