Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Reading from Registry

Posted on 2004-09-24
8
Medium Priority
?
206 Views
Last Modified: 2013-11-13
Hey,

How would I do this code so when I click a button it searches under LOCAL_MACHINE\Software\MyAPP\Random and if the word in the edit box is the same as the one under that key it says Ok other wise it says Go Away.

Cheers,

Computer Programer
0
Comment
Question by:computerprogramer
  • 3
  • 3
8 Comments
 

Expert Comment

by:dan-g
ID: 12147622
Which language?
0
 

Author Comment

by:computerprogramer
ID: 12147637
Bugger!

I posted it in the wrong forum. It should be in Delphi. So the language is Delphi.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12147668
0
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.

 

Author Comment

by:computerprogramer
ID: 12153579
I dont get that could someone else show me how to do this?
0
 

Expert Comment

by:dan-g
ID: 12154198
The "short answer" from the first of jaime olivares's links is this:

>> If you have a name of the value (string)then here are functions you need:
>> Tregistry.readstring
>> Tregistry.readfloat
>> Tregistry.readinteger
>> and so on...
>> Bye
>> Duke Nukem.

Here is a web page with more details & examples:

http://www.howtodothings.com/showarticle.asp?article=76

Here's a sample from that article:

-------------------------------------------
  uses Registry, Windows, Dialogs;

  procedure TForm1.Button1Click(Sender: TObject);
  var
    Reg: TRegistry;
  begin
    Reg := TRegistry.Create;
    Reg.RootKey := HKEY_LOCAL_MACHINE;
      if Reg.OpenKey('\Hardware\Description\System'
        + '\CentralProcessor\0', False) then begin
      ShowMessage(Reg.ReadString('Identifier'));
      Reg.CloseKey;
    end; // if
    Reg.Free;
  end;
-------------------------------------------

Does this answers your question?

Dan.
0
 

Author Comment

by:computerprogramer
ID: 12156217
Yes it kind of does,

Apart from I want to implement it so if the value = the text in the editbox then it will say word found.

Cheers
0
 

Accepted Solution

by:
dan-g earned 100 total points
ID: 12158960
Could be something like this (please note, I rarely work in Delphi and don't have a compiler installed, so there might be some syntax errors or typos):

-------------------------------------------
  uses Registry, Windows, Dialogs;

  procedure TForm1.Button1Click(Sender: TObject);
  var
    Reg: TRegistry;
  begin
    Reg := TRegistry.Create;
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('\Hardware\Description\System'
        + '\CentralProcessor\0', False) then
      begin
        Reg.ReadString('Identifier'));
        If Reg.ReadString('Identifier') = Edit1.Text then
          begin
          ShowMessage(Reg.ReadString('OK'));
          end
        else
          begin
          ShowMessage(Reg.ReadString('Go Away'));
          end;
        end; //if
      Reg.CloseKey;
    end; // if
    Reg.Free;
  end;
-------------------------------------------

I hope this completes the missing part...

Dan.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

972 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