|
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)
|
|
|
Re: reading regestry on windows system [message #41598 is a reply to message #41597] |
Fri, 12 November 2004 11:51  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Michael Wiekenberg wrote:
> Hello everyone,
>
> i'am surching for a posibility to read a key value out of the
> registry.
<snip>
> But how can i read the value of that key to use it in IDL?
>
> Or exists a better methode to get the user dir?
Not that this is the easiest way but this would be a very simple .dlm to
write. With Ronn Kling's "Calling C from IDL" it would probably only
take you a few hours, even if you are a C novice. For hints, you can
check out my directInput.dlm. It contains an couple of unrelated
functions to get system metrics. you could chop out all of the
directInput stuff and use these are starting points.
On the windows side there are a number of ways to set/get keys. The
Win32 api would probably be easiest if you are unfamiliar with MFC.
http://www.acoustics.washington.edu/~towler/programs/directI nputSource.zip
If you get this up and running, please share! :)
-Rick
|
|
|
Re: reading regestry on windows system [message #41653 is a reply to message #41598] |
Fri, 12 November 2004 07:36  |
Ralf Schaa
Messages: 37 Registered: June 2001
|
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
>
> But how can i read the value of that key to use it in IDL?
>
> Or exists a better methode to get the user dir?
>
> Thanks fpr reading and maybe for thinking about!
> Would be happy about some suggestions or resolutions :]
since I like perl in combination with spawn, I suggest:
Win32::Registry::File - Perl interface to MS-Windows registry files
cheers
-ralf
|
|
|
Re: reading regestry on windows system [message #41656 is a reply to message #41653] |
Fri, 12 November 2004 02:52  |
Karsten Rodenacker
Messages: 98 Registered: July 1997
|
Member |
|
|
Maybe getenv(/environment) gives, what you are looking for.
Regards
Karsten
On 12 Nov 2004 02:06:49 -0800, Michael Wiekenberg <norford@gmx.de> 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
>
> But how can i read the value of that key to use it in IDL?
>
> Or exists a better methode to get the user dir?
>
> Thanks fpr reading and maybe for thinking about!
> Would be happy about some suggestions or resolutions :]
--
Karsten Rodenacker
------------------------------------------------------------ -------- :-)
GSF - Forschungszentrum Institute of Biomathematics and Biometry
D-85758 Oberschleissheim Postfach 11 29
Karsten.Rodenacker@gsf.de | http://ibb.gsf.de/ | DEL _ for reply
http://ibb.gsf.de/homepage/karsten.rodenacker/
Tel: +49 89 31873401 | FAX: ..3369
|
|
|