Re: Dialog size in pixel
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Fri, 27 Jun 2008 17:23:22 -0400
In a couple situations, the algorithm is
Read the Registry from HKCU
if that fails, read the Registry from HKLM
if that fails, use the hardwired default
This allows the sysadmin to set up "standard defaults" during installation but allows the
user to override them.
My Registry classes, for example, have options like
RegistryInt whatever(IDS_REGISTRY_WHATEVER);
whatever.load(0);
where 0 is the default value to be used.
joe
On Fri, 27 Jun 2008 10:19:05 -0500, "Doug Harrison [MVP]" <dsh@xxxxxxxx> wrote:
On Thu, 26 Jun 2008 22:01:27 -0400, Joseph M. NewcomerJoseph M. Newcomer [MVP]
<newcomer@xxxxxxxxxxxx> wrote:
For something like configuration state, it should be treated like the Registry; according
to the latest standards I've seen, a program must be robust and assume that any key inthe
registry can be removed at any time, arbitrarily, including the entire subtree for the
application. The rule was that "no program shall have its installer create registry
entries that cannot be re-created by the execution of the program" or some such phrase.
In one program I had, we needed to have the path to the DLL for an explicit LoadLibrary
call. This was because we were sharing a DLL with a third-party application. I had a
cached copy in the Registry, and the recovery process went like this:
Use the Registry key value
If that fails, check to see if the product is installed
If the product is installed, try loading from its execution directory
If that fails, prompt the user
Unable to locate the required
"c:\...full path here...\whatever.dll"
Do you want to search for it
[Yes] [No]
If the user selects Yes, pop up a file-open box
If the user selects No, abort the command that needed the DLL
That is, the program was prepared to re-create its entire Registry key from the ground up,
for any value. Those values which represented user options were easy; there were many
options dialogs available. But those that could not be represented by an explicit dialog
had recovery dialogs like the one above.
Obviously this does not work for .pst files and other such critical files, but for
configuration data, you have to assume at any point that the file has been deleted and be
prepared to reconstruct it.
joe
Yep, that's good common sense. My registry "read" functions all take
default arguments and return them when the registry value is missing, and
the "save settings" functions recreate the registry hierarchy as necessary.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- Re: Dialog size in pixel
- From: David Ching
- Re: Dialog size in pixel
- From: Mihai N.
- Re: Dialog size in pixel
- From: Tom Serface
- Re: Dialog size in pixel
- From: Joseph M . Newcomer
- Re: Dialog size in pixel
- From: Tom Serface
- Re: Dialog size in pixel
- From: Joseph M . Newcomer
- Re: Dialog size in pixel
- From: James Juno
- Re: Dialog size in pixel
- From: Doug Harrison [MVP]
- Re: Dialog size in pixel
- From: Joseph M . Newcomer
- Re: Dialog size in pixel
- From: Doug Harrison [MVP]
- Re: Dialog size in pixel
- Prev by Date: Re: Fragmented memory compaction ???
- Next by Date: Re: how to store list of varying types
- Previous by thread: Re: Dialog size in pixel
- Next by thread: Re: Dialog size in pixel
- Index(es):
Relevant Pages
|