| Re: reading regestry on windows system [message #41597 is a reply to message #41578] |
Fri, 12 November 2004 13:51   |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
Michael Wiekenberg wrote:
> Hello everyone,
>
> i'am surching for a posibility to read a key value out of the
> registry.
> My Problem:
> I'd like to save files in a standard path. this is on a unix system
> '~/myprog/'
>
> on a windows system it should be the myprog dir in the personal dir of
> user which is setted in
> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ Explorer\Shell
> Folders\personal
On my system that key has the value
D:\Documents and Settings\Hadfield\My Documents
It seems odd to put programs in a "documents" directory. I should think
a more suitable location (and a better match to ~/myprog/ on Unix) is
one level up, ie
D:\Documents and Settings\Hadfield
On my system the latter directory is available as an environment
variable, USERPROFILE. It would be easier to access an environment
variable than to read the registry.
This is a Windows 2000 system--I don't know about Windows 9x.
You may also be interested in how IDL addresses this issue. The
documentation says the following under environement variables:
HOME
IDL uses the value of the $HOME environment variable when storing
user-specific information in the local file system.
Note
------------------------------------------------------------ --------------------
Under Microsoft Windows, the HOME environment variable may not be set in
all cases. If it is not set, IDL first attempts to substitute the
USERPROFILE environment variable (which usually looks something like
C:\Documents and Settings\username where username is the login name of
the current user). If USERPROFILE is not set, IDL uses the value of the
first of the following it finds: the TEMP environment variable, the TMP
environment variable, the Windows system directory.
------------------------------------------------------------ --------------------
Finally, note that in IDL 6.1 the APP_USER_DIR and APP_USER_DIR_QUERY
functions were added to support storage of user-specific info.
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|
|