Delphi - Knowledge Base Home  About Us  .Net  Solutions  Microsoft  Extras  Contact Us  Freeware  

Topics

Our Delphi article links are shown below. Simply click a link to get started..
 
Delphi Home
Link to this page



Popular Articles

1. Registry walk through & best practice

2. Using the Microsoft Word COM interface

3. Using the Microsoft Excel COM interface

4. Creating & Using Lookup Forms in Delphi

5. Using encryption in your applications

6. Creating and using splash screens in Delphi

7. Using Dev Express to mimic .NET & XP Styles

8. Using the Microsoft Outlook COM interface


  





Delphi - Registry (2)

These folders are the recommended place to store your application data. The difference being that the CURRENT_USER folder is specific to the current user who is logged in. The other folder is specific to the machine itself. We must appreciate this difference to learn where to store different data value.

The CURRENT_USER folder is ideal for user specific data such as last login name or preferred application colours. The LOCAL_MACHINE is the best place for global values such as database path which are used by all users

To store data to the registry all you need to supply is a key value pair. Before writing or reading to the registry you need to set the path.

We recommend that you write to a path such as:

HKEY_CURRENT_USER\Software\Company Name\Application Name\


Now we will concentrate on how we can read and write to the registry using Delphi(5) as our development language
         
As with all object oriented languages Delphi is no different. We must create an object to the class that we wish to use. In this case we want to access registry methods and properties and hence we require the registry.pas class:

var
  aReg : TRegistry;
begin
  aReg : TRegistry.Create

Once we have an object of the registry class we can start to use the property and methods to write to the database:

with aReg do
  aReg.RootKey := HKEY_CURRENT_USER
  if OpenKey('Software\Company Name\Application Name\Preferences', false) then
 try
  WriteInteger('TextBox Colour', 123456);
  finally
  CloseKey;
  end;

finally
aReg.Free;
end;




 Back (Page 1)  Next (Page 3)

Featured

Other popular Delphi resources. Why not try them for yourself?



                   


    

Extras Microsoft Practice Exams Software Directory Music Tracks Net Components Windows Process
Web Hosting Delphi Amiga Games Processos de Windows Braindumps
Buy Products Latest Reviews Absolute Adsense Free Web Templates

  Home  Links  About Us
Copyright © Accelerated Ideas 2005-2008
All rights reserved.


Delphi Knowledge Base. Best practices, walkthroughs, tutorials, component advice and more. Solutions and professional designs for Delphi 4, Delphi 5, Delphi 6 and Delphi, 7. Word COM, Excel COM, Outlook COM including code examples for Word OLE, Excel OLE and Outlook OLE. Automating Outlook to create MailItem and send attachments in Delphi. ActiveX, Com. ADO Data Architecture, TMS component pack walk through and code examples. Using Developer Express and example walkthroughs. Date & time conversion routines, video playback and frame manipulation. COM articles, papers, tips, techniques and hints. How to create Word reports and excel spreadsheets using Delphi code and OLE automation. Understanding Delphi encryption and using ciphers, with source code examples of Blowfish, Twofish, and Rijndael. Securing application data and confidential information using open source encryption components. Free encryption dll component. Accessing and managing MS Excel sheets with Delphi. How to retrieve, display and edit Microsoft Excel spreadsheets with Delphi automation. Accessing and managing MS Word documents with Delphi. How to retrieve, display and edit Microsoft Word documents using Delphi automation. Read and write Excel spreadsheets using Delphi code. How to read and write registry entries using Delphi code. Source code examples using Delphi 5, Delphi 6 and Delphi 7. Working with VCL Developer Express components. How to apply grid styles and themes to Delphi applications. Using image columns and shading to improve the grid and treeview appearances. Including examples from ExpressQuantumPack, for Delphi, ExpressPack for Delphi. Developer guides for Developer Express components. All our articles are written by our senior Delphi professionals to help you get the best from your legacy Delphi applications