Page 1 of 1
Posted: Fri Mar 21, 2003 5:15 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.
This does not create the required entry in the existing "myapp.ini" file...
Code: Select all
Result = OpenPreferences(appdir$+"myapp.ini")
If Result
PreferenceGroup("") ; No grouping
s$ = ReadPreferenceString("MY_ADDINS", "")
If s$=""
s$ = "myaddin.dll"
Else
s$ = "myaddin.dll,"+s$
EndIf
WritePreferenceString("MY_ADDINS", s$)
ClosePreferences()
EndIf
PS: "MY_ADDINS" entry may/ may not exist. At the moment it does not.
Posted: Fri Mar 21, 2003 6:50 pm
by BackupUser
Restored from previous forum. Originally posted by GPI.
OpenPreference() is only for read!
And don't test, if the result is true, because then you can only open a existing file!
When you not test, you get back the default-settings.
And when you dont have a group, you don't need PreferenceGroup()!
OpenPreferences(appdir$+"myapp.ini")
s$ = ReadPreferenceString("MY_ADDINS", "")
If s$=""
s$ = "myaddin.dll"
Else
s$ = "myaddin.dll,"+s$
EndIf
closepreference()
if createpreference(appdir$+"myapp.ini")
WritePreferenceString("MY_ADDINS", s$)
ClosePreferences()
EndIf
Posted: Fri Mar 21, 2003 7:27 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.
Hi GPI, thanks for the info but my ini file *does* already exist. I'm just trying to change/ add one entry. I cannot use createpreference() because according to help...
"Creates a new empty preference file. If the file already exists, the file is erased"
Posted: Fri Mar 21, 2003 8:32 pm
by BackupUser
Restored from previous forum. Originally posted by GPI.
Than you must read complete the preference-file and write complete the reference-file!
When you want to change the meaning of one of your preference-strings you should rename it.
PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB