You all may laugh if you will, but I find that it's very simple to use a .MEM file for this single piece of data. It's much easier than writing to the registry (which as far as I can tell is never necessary although since mine crashes all the time I'm biased.)
You can't just use a hardcoded path from the calling .EXE directory if you are running on a network. So I have the program look immediately for THISAPP.MEM. You could as easily use an INI, but I prefer to keep other settings in a table. Eventually I will set it up like this and ditch the MEM file:
- Put a local machine settings table in a set path from the calling directory, and a user/system settings table in the data path. The data path will be listed in the MACHINE.DBF table. The structure of the settings table is:
SE_Name C 50 - A name such as "DATAPATH"
SE_Type C 1 - Same as returned by Type()
SE_Value Memo - Value of the setting
SE_Us_key N 10 - link to the user table, 0 if not applicable.
Then you have library routines to set and retrieve settings. The library routine to set should automatically add a new setting if it is not found, giving it a default value passed to it.
Adam
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement