Page 2 of the Setup dialog displayed when the user runs Stonefield Query for the first time includes information about the user: their name, company name, and email address. If you already have this information stored somewhere, you may wish to fill out this information automatically. That's what the Registration.Settings script is used for.

Parameters
A reference to the Stonefield Query Application object and a reference to an object whose properties contain the values of the registration information. These properties are:

  • Company: the name of the company

  • Contact: the name of the contact person at the company

  • Email: the contact's email address

The script code can change any of these properties as necessary. For example, it could read values from the Registry by calling the GetRegistryValue method of the Application object.

Return Value
Any value (Stonefield Query ignores the return value).

Example
Visual FoxPro
Here's an example that reads registration information from a table in an existing application. The Application object's TargetApplicationDirectory property contains the location of this table.

lparameters toApplication as SQApplication, toSettings
local lnSelect
lnSelect = select()
select 0
use (toApplication.TargetApplicationDirectory + 'USERS')
toSettings.Company = trim(Company)
toSettings.Contact = trim(Contact)
use
select (lnSelect)

VBScript
This example reads registration information from the Windows Registry.

function Main(Application, Settings)
Settings.Company = Application.GetRegistryValue("Company", _
  "", "\Software\SomeCompany\SomeApplication\Registration")
Settings.Contact = Application.GetRegistryValue("UserName", _
  "", "\Software\SomeCompany\SomeApplication\Registration")
end function

JavaScript
This example reads registration information from the Windows Registry.

function Main(Application, Settings) {
Settings.Company = Application.GetRegistryValue('Company', 
  '', '\Software\SomeCompany\SomeApplication\Registration') ;
Settings.Contact = Application.GetRegistryValue('UserName', 
  '', '\Software\SomeCompany\SomeApplication\Registration') ;
}

C#

Please note that the method in this script must be named Registration_Settings.

public static void Registration_Settings(SFQApplication sfqApplication, 
  Settings settings)
{	
  settings.Company = sfqApplication.GetRegistryValue("Company", "", 
    @"HKEY_CURRENT_USER\Software\SomeCompany\SomeApplication\Registration");
  settings.Contact = sfqApplication.GetRegistryValue("UserName", "", 
    @"HKEY_CURRENT_USER\Software\SomeCompany\SomeApplication\Registration");
}

VB.NET

Please note that the method in this script must be named Registration_Settings.

public shared function Registration_Settings(sfqApplication as SFQApplication,
  settings as Settings) as Boolean
  settings.Company = sfqApplication.GetRegistryValue("Company", "",
    "HKEY_CURRENT_USER\Software\SomeCompany\SomeApplication\Registration")
  settings.Contact = sfqApplication.GetRegistryValue("UserName", "",
    "HKEY_CURRENT_USER\Software\SomeCompany\SomeApplication\Registration")
  Return True
End Function

See also

Scripts

© Stonefield Software Inc., 2023 • Updated: 06/06/16
Comment or report problem with topic