Solved

Reading from Registry

Posted on 2004-09-24
8
195 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 25 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about problems I had with the new location API and permissions in Marshmallow
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 fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

943 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

Need Help in Real-Time?

Connect with top rated Experts

1 Experts available now in Live!

Get 1:1 Help Now