If I wanted to write under my program named prog1, to the settings section and set the windowstate key to 1 (meaning true) then it would be done like this.
[CS]
WritePrivateProfileString ("settings", "windowstate", "1", "C:\\myini.ini");
[/CS]
Reverse that for reading.
I also found this doing a search, you may find it helpful. Its an atatchemnt, I had to upload with .txt extension, but its C# code.