?
Solved

Reading Registry - easy..... I think.

Posted on 1998-08-13
4
Medium Priority
?
133 Views
Last Modified: 2010-04-04
Here's the deal........ I've done many registry reads, writes, etc..., without a problem......
but I am now trying to read the value "[Default]" or "(Default)" as many of the applications
have listed for a directory install. (This value is just about everywhere in the registry).

I thought this would be just like any other read, but I can't seem to get this value.
For example,
    If the registry has 2 values to extract (after opening the key) and the only 2 values are
    [Default]
    Path

    If I plug this readstring command into my code:
    Temp_Str  := ReadString('Path');
    then my code will execute fine and get the value.
    If I replace the same string with:
    Temp_Str  := ReadString('[Default]');
    then it won't return anything....... even though both "Path" and "Default" contain strings.
    It has to be possible to read this, anyone know what I'm missing here?  I tried (Default) thinking
    that I was misinterpreting the ending characters, but that doesn't work either.

                        Thanks
0
Comment
Question by:jexd99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 200 total points
ID: 1362072
Sample:
HKEY_LOCAL_MACHINE\Software\SampleKey\(Default)
Now do NOT the following:
OpenKey("HKEY_LOCAL_MACHINE\Software\SampleKey");
ReadVal("(Default)");
But do the following:
OpenKey("HKEY_LOCAL_MACHINE\Software");
ReadVal("Software\"); or ReadVal("Software");
0
 

Author Comment

by:jexd99
ID: 1362073
What is specified above won't work, as there could be many subkeys listed besides "samplekey" (I probably didn't specify this clear enough).  I need the value for (Default)......
For example, for wordpad,  if [Default] is "c:\mydir" and it is located at  

Software\Microsoft\Windows\CurrentVersion\App Paths\Wordpad.exe\[Default] then

       If OpenKey('Software\Microsoft\Windows\CurrentVersion\App Paths\Wordpad.exe',                         False) then
            Test := ReadString('[Default]');
            closekey;
       end;

will not work, but any other subkeys besides "[Default]" works fine and returns a string, but I can't get the string at [Default]  (I've tried [] and () around it......)
?
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1362074
Ooops. Perhaps I should try my suggestions before answering...

Now I tried it out and what you have to do is:

       If OpenKey('Software\Microsoft\Windows\CurrentVersion\App Paths\Wordpad.exe',False) then
            Test := ReadString('');
            closekey;
       end;

It's a little bit strange, isn't it? But it works...
0
 

Author Comment

by:jexd99
ID: 1362075
Wow, that is strange.  It figures that this isn't specified anywhere.  Maybe if I would have bought the $15 help section upgrade in D3, this would have been covered. :-)
Thanks, just glad to see that this now works !!! :-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question