Solved

Reading from Registry

Posted on 2004-09-24
8
194 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you don't know how to downgrade, my instructions below should be helpful.
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 fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

744 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

12 Experts available now in Live!

Get 1:1 Help Now