Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add a key to a ini file?
Message
 
To
15/11/2002 15:41:08
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00721447
Message ID:
00723451
Views:
12
>>>>>
>>>>>Although it will work, but if i try to write a value for this key, always failed.The GetPrivateProfileString API always return this key's name!
>>>>>
>>>>>How can i do?
>>>>
>>>>In addition to Ed's reply, you can use my IniFiles class from the download section.
>>>
>>>
>>>I've been playing around with the IniFiles class this afternoon and found that the methods used to write keys don't work under Win2k (Win98 ok). The read methods work fine.
>>>
>>>Any ideas? I haven't played with REGISTRY.VCX yet but that's next on the list.
>>
>>I just ran a test under Win2K Pro SP3 without a problem. The file, BTW, didn't originally exist.
SET PROCEDURE TO inifiles ADDITIVE
>>oIni = CREATEOBJECT('Ini_Files')
>>lcini = ADDBS(SYS(5) + SYS(2003)) + 'foo.ini'
>>oIni.PutIniEntry('geo', 'entry', 'value', lcini)
>>* File was created with the appropriate entry
>>oIni.PutIniEntry('geo', 'entry2', 'value2', lcini)
>>* New entry was added
Are you, by any chance trying to write to WIN.INI?
>
>George, it worked fine on a couple of other pc's. I've spent the last two days reloading Win2k and my apps and now the class works perfectly. Problem solved.

Good to hear. BTW, the reason I mentioned WIN.INI is that calls to that file also map to the registry.

BTW, this has reminded me that I hadn't tested the code against Win2K (now done) and XP (not done yet). So I owe you a thank you for reminding me that I do/did need to test against those platforms.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform