Previous Document Next Document

Object Model Reference : Classes : C : CorelScriptTools : Methods : CorelScriptTools.RegistryQuery


CorelScriptTools.RegistryQuery

Function RegistryQuery(MainKey As Long, SubKey As String, Value As String) As Variant

Description

Member of CorelScriptTools

The RegistryQuery method returns the value data of a specified value key in the computer’s Windows registry. This function can help you determine where programs and files are installed on a user’s computer. This type of information is important when creating scripts that are to run on different system setups.

Parameter
Description
MainKey
Specifies the main registry value key to query:
0 = HKEY_CLASSES_ROOT
1 = HKEY_CURRENT_USER
2 = HKEY_LOCAL_MACHINE
3 = HKEY_USERS
4 = HKEY_PERFORMANCE_DATA
5 = HKEY_CURRENT_CONFIG
6 = HKEY_DYN_DATA
SubKey
Specifies the sub registry value key to query. This must be a complete key path. In Windows 95 for example, SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts is a complete path.
Value
Specifies the registry value key to query. To specify a default value, use an empty string. Specify an empty string by using two quotation marks ("").

The return value specifies the variable that is passed the value data of a specified value key in the Windows registry. Since this function can pass a string or numeric value, the variable you specify should be a variant. You can use the CorelScriptTools.GetType function to determine a variant’s subtype.

 
You cannot use this command to query binary values except those that can be converted to a number.
Example 1

The following VBA example returns the root folder where Corel VENTURA 7 is installed.

Config_Ventura = REGISTRYQUERY (2, "SOFTWARE\Corel\Corel Ventura\7.0", "ConfigDir")
Example 2

The following VBA example returns the Arial True Type font’s file name.

Arial_file = REGISTRYQUERY (2, "SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts", "Arial (TrueType)")
Example 3

The following VBA example returns the name of the registered owner of Corel software:

YourName$ = REGISTRYQUERY(2,"SOFTWARE\Corel","UserName")
Example 4

The following VBA example returns the organization name of the registered owner of Corel software:

CompanyName$ = REGISTRYQUERY(2,"SOFTWARE\Corel","ORGANIZATION")
Example 5

The following VBA example returns the phone number of the registered owner of Corel software:

Phone$ = REGISTRYQUERY(2,"SOFTWARE\Corel","PHONENUMBER")

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.