Click to See Complete Forum and Search --> : .net and INI-Files ???


PACUS
August 25th, 2003, 09:52 AM
Are there some Funktions to read/write a INI-File under .inet(under MFC I used GetPrivatProfilString) ?

HeartBreakKid
August 25th, 2003, 01:30 PM
Does GetPrivateProfileString() no longer work? It is documented in the .NET MSDN. It does state that the function is only for compatability with 16-bit Windows-based application, and newer application should store this type of information in the registry.

GetProfileString() reads information from the registry (SetProfileString() to set it).

Don't be discouraged by the fact that Windows "wants" you to store everything in the registry. The registry can be quite helpful, but there are some applications where it cannot be used.

One of our customer has machines on lease, and therefore have no access to the LOCAL_MACHINE registry. We had to use an INI file for settings that would not change from user to user. We could have duplicated all of the entries for each user, but then updates would have to be done in multiple areas as well. We determined that in this case, we would use an INI file.

MooNull
August 25th, 2003, 11:36 PM
Try the System::Configuration namespace. Though I may be thinking of the wrong one... I know I saw a .NET ini parser around here somewhere...

PACUS
August 26th, 2003, 09:46 AM
When I use the GetPrivateProfileString Functions i must include the afxwin.h. But when i include this some Funktions from .Net dosn't work
(example: System::IO::Directory::GetCurrentDirectory();)


I can't find the .Net INI Parser :(

Cyber Dog
October 21st, 2003, 04:07 AM
There's an article here about using new methods in .NET to replace the traditional INI file:
http://www.devx.com/dotnet/Article/7008

as well as an article here about using the original INI file format in .NET:
http://www.devx.com/dotnet/discussions/040902/cominterop.asp