Hi Jimi,
My recollection is that WritePrivateProfileString can be used to delete an entry or even a whole section.
MSDN says (and I haven't tested it) that passing a null (chr(0)) to the lpKeyName parameter will erase the entire app section, and passing a null to the lpString parameter will erase the key.
Cheers,
Andrew
>Hi all,
>
>I have an application which need an INI file to start up. And I have another VFP program which is used to maintain this INI file.
>
>Since I only know how to write on and read from the INI file (with WritePrivateProfileString and GetPrivateProfileString). If there is some old settings in the INI files that I dont need, I have to delete the whole INI file and rewrite it once more in the program. I did this in the "save" command of my program.
>
>e.g.
>old INI:
>[EXAMPLE]
>A=123
>B=234
>C=456
>
>if I dont want the B=234, I have to delete the whole file and write A=123 and C=456 in the file once more.
>
>The problem is, after I write the file again, the application cannot find the INI file. I have to use the explore to browse the folder once and make the INI file "appear", then the application can read it normally.
>
>This causes great trouble in my application, may I ask how can I avoid from this "disappeared" file problem? Or how can I delete a key from the INI file without using such stupid way?
>
>I wish I have descript my question clearly, everyone PLEASE help! :(
>
>-Jimi
If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?
From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."
All my FoxTalk and other articles are available on my
web site.
Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.