How do I develop Delphi applications that manage profiles?

Last reviewed: 12/15/2011

HOW Article ID: H071125

The information in this article applies to:

  • ProfileKit 4

Summary

You can develop Delphi applications that manage speaker profiles using your favorite version of Delphi.

More Information

ProfileKit includes a Delphi Pascal source file (.pas) comprised of the Delphi classes that manage speaker profiles.

To access the ProfileKit Delphi classes within your application, first add a project reference to the ProfileKit Delphi source files:

  1. Within your Delphi project, select Project Options.
  2. Select the Delphi compiler options.
  3. Add Search path reference to the ProfileKit unit source file directory: C:\Program Files\Chant\ProfileKit 4\Win32\Delphi\source.
  4. Add unit output path reference to the local directory with a period '.' character.
  1. Within your Delphi project, select Project Options.
  2. Select the Delphi compiler options.
  3. Add Search path reference to the ProfileKit unit source file directory: C:\Program Files\Chant\ProfileKit 4\Win64\Delphi\source.
  4. Add unit output path reference to the local directory with a period '.' character.

To access the ProfileKit Delphi classes within your application, add a reference to the ChantShared and ProfileKit units in your uses clause:


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ChantShared, ProfileKit;

Add an event handler declaration and Object instance variable to the application declarations:


type
TForm1 = class(TForm)
...
private
{ Private declarations }
public
{ Public declarations }
procedure OnHasEvent(var msg: TMessage);
    message WM_APP+6;
end;

var
Form1: TForm1;
ChantPM1: TChantPM;

Object Instantiation

Instantiate an instance, set the license and serial properties, and set the event handler message.


procedure TForm1.FormCreate(Sender: TObject);
begin
ChantPM1 := TChantPM.Create();
// Set license properties
ChantPM1.SetStringProperty(CSPLicense,'LicenseRegistrationNumber');
ChantPM1.SetStringProperty(CSPSerials,'LicenseSerialNumber');

// Define the HasEvent callback message
ChantPM1.SetWindowMessage(Handle, WM_APP+6, 0, 0);

end;

Event Callbacks

Event callbacks are the mechanism in which the component library sends information back to the application such as import/export operation state, training state, or there was an error.


procedure TForm1.OnHasEvent(var msg: TMessage);
var
aTChantPMEvent: TChantPMEvent;
i: Integer;
begin
    numberOfEvents := ChantPM1.GetResourceCount(CSREvent,0,0);
    for i := 0 to numberOfEvents - 1 do
    begin
        // Get the event from the event queue
        aTChantPMEvent := ChantPM1.GetChantPMEvent(0);
        case tEvent.ChantCallback of
        CCSRProgress:
        ...

        end;

        ...

        // Remove the event from the event queue
        ChantPM1.RemoveResource(CSREvent);
        aTChantPMEvent.Destroy();
    end;
end;

Deployment Checklist

When you are ready to deploy your Delphi application, you need to ensure you have a valid license, bundle the correct Chant component library, and configure your installation properly on the target system. Review the following checklist before deploying your applications:

  • You may deploy your Delphi application to any system with a valid license from the Chant.
  • Copy CProfileKit.dll to the target system and place in the same directory with your application.
  • You may deploy your Delphi application to any system with a valid license from the Chant.
  • Copy CProfileKitX64.dll to the target system and place in the same directory with your application.

Sample Projects

Delphi sample projects are installed at the following location:

  • My Documents\Chant ProfileKit 4\Win32\Delphi\RS 2007,
  • My Documents\Chant ProfileKit 4\Win32\Delphi\RS 2009,
  • My Documents\Chant ProfileKit 4\Win32\Delphi\RS 2030,
  • My Documents\Chant ProfileKit 4\Win32\Delphi\RS XE,
  • My Documents\Chant ProfileKit 4\Win32\Delphi\RS XE2, and
  • My Documents\Chant ProfileKit 4\Win32\Delphi\RS XE3.
  • My Documents\Chant ProfileKit 4\Win64\Delphi\RS XE2 and
  • My Documents\Chant ProfileKit 4\Win64\Delphi\RS XE3.