IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...OPAL: Langua...   Print This     
  From the September 2013 Issue of Prestwood eMag
 
Paradox OPAL: Language Details:
Using The Windows Registry with Paradox
 
Posted 17 years ago on 12/29/2007 and updated 6/12/2008
Take Away: ObjectPAL methods for using the Window's registry to store and retrieve configuration settings.

KB100770

Two popular techniques for storing configuration information is to use initialization (.INI) files and the Windows registry. Both the older INI files and the newer registry are still used today but Microsoft recommends using the registry over INI files. The registry holds information about the computer hardware configuration, installed software, settings, preferences, and file associations. Should I still use .INI files in 32-bit Windows? You bet. However, use them sparingly. Your first choice for information about your software should be the registry and only when you run into a reason not to use the registry should you use initialization files.

Registry Methods

The preferred method of storing software information is to use the registry. ObjectPAL offers several methods for manipulating the registry including setRegistryValue(), getRegistryValue(), deleteRegistryValue(), searchRegistry(), and enumRegistryKeys().

Using setRegistryValue() and getRegistryValue()

The setRegistryValue() method sets a value in the registry. Here is the syntax:

setRegistryValue ( const key String, const value String, const data AnyType, const rootKey LongInt) Logical

If either the key or value do not exist, it will be created.

The rootKey is analogous to a directory drive. The rootKey should be set with the predefined constants: regKeyCurrentUser, regKeyClassesRoot, regKeyLocalMachine, or regKeyUser.

The following example sets the current ObjectPAL level in the registry.

;Button :: pushButton 
method pushButton(var eventInfo Event) 
var 
	sKey, sValue, sData, sLevel String 
endVar  
sKey = "Software\\Borland\\Paradox\\7.0\\PDOXWIN\\Properties" 
sValue = "Level" 
sData = "Advanced" 
setRegistryValue( sKey, sValue, sData, regKeyCurrentUser ) 
endMethod

getRegistryValue() is the counter part to setRegistryValue(). It retrieves a value from the registry. Here is the syntax:

getRegistryValue ( const key String, const value String , const rootKey LongInt ) AnyType

The following example get the current ObjectPAL level from the registry.

;Button :: pushButton
method pushButton(var eventInfo Event)
var
	sLevel, sKey, sValue String 
endVar
sKey = "Software\\Borland\\Paradox\\7.0\\PDOXWIN\\Properties"
sValue = "Level"
sLevel = getRegistryValue(sKey, sValue, regKeyCurrentUser )
sLevel.view("ObjectPAL Level")
endMethod

Notice that the syntax for getRegistryValue() shows that it returns a value of type AnyType, sLevel is of type string because we knew ahead of time what the return type would be. If you don't, then return the value to a variable of type AnyType. Setting and retrieving values from the Windows registry is easy with Paradox.


Comments

1 Comments.
Share a thought or comment...
Comment 1 of 2
<p>a real gem of information - it didn&amp;#39;t even occur to me that&amp;nbsp;OPAL had ready access tothe registry.</p><p>thanks for the article Mike</p>
Posted 16 years ago

Comment 2 of 2

Paradox has shared all about the registry. Now it will get easier for us to proceed with this method. You need to check essaygeeks.co.uk reviews that help to write the best essay for college. To face the challenges of life, education is a must that makes a man strong and worthy in all aspects.

Posted 41 months ago
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P157A1
Enter key:
KB Post Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100770 Counter
9119
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]