TPAXScripter Registration Routines


FreeImportLibarary

Unloads import library.
function FreeImportLibrary(H: Cardinal): LongBool;

See Also

LoadImportLibrary

Loads a dll which contains imported Delphi classes.
function LoadImportLibrary(const DllName: String): Cardinal;

LoadImportLibrary allows you to import Delphi classes from a dll. You can generate source code of the dll by means of paxScript importer (paximp.exe).

See Also

RegisterClassType

Registeres a Delphi class.
function RegisterClassType(PClass: TClass; Owner: Integer): Integer;

Arguments

PClass
A Delphi class.
Owner
Determines handle of namespace which contains the class.

Returns handle of the namespace.

Example

Delphi:

initialization
.....................

H := RegisterNamespace('MyNamespace');
H := RegisterClassType(TMyClass, H);

C++ Builder:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
 int h = RegisterNamespace("MyNamespace", - 1);
 RegisterClassType(__classid(TMyClass), h);
}

The class becomes available for all TPaxScripter instances.

RegisterConstant

Registeres a constant.
procedure RegisterConstant(const Name: String; Value: Variant; Owner: Integer = -1);

Arguments

Name
Name of constant.
Value
Value of constant.
Owner
Determines handle of namespace which contains constant.

Example

initialization
................

H := RegisterNamespace('MyNamespace');
RegisterConstant('MyConst', 90, H);

The constant becomes available for all TPaxScripter instances.

RegisterField

Allows you to register a private, protected or public field of a Delphi class.
procedure RegisterField(PClass: TClass; const FieldName, FieldType: String;
                        Offset: Integer);

Arguments

PClass
A Delphi class.
FieldName
Name of field.
FieldType
Type of field.
Offset
Offset of field.

Example

Click here.

TPaxScripter.RegisterInterfaceType

Allows you to register an interface type.
function RegisterInterfaceType(const Name: String; const Guid: TGuid; const ParentName: String; const ParentGuid: TGUID; OwnerIndex: Integer = -1): Integer;

Arguments

Name
Name of interface type
Guid
GUID of the interface type.
ParentName
Name of parent type
ParentGuid
GUID of parent type.
OwnerIndex
Index of namespace.

Example

H := RegisterNamespace('MyUnit', -1);
RegisterInterfaceType('ITest',ITest,'IUnknown',IUnknown,H);
RegisterInterfaceMethod(ITest, 'procedure Proc(A: Integer); overload;');

TPaxScripter.RegisterInterfaceMethod

Allows you to register a method of interface type.
procedure RegisterInterfaceMethod(const Guid: TGUID; const Header: String;MethodIndex: Integer = -1);

Arguments

Guid
Guid of the interface
Header
Header of method
MethodIndex
Index of method. QueryInterface has index 1, _AddRef has index 1, _Release has index 3 and go on. If MethodIndex is -1, it will be determined automatically.

Example

H := RegisterNamespace('MyUnit', -1);
RegisterInterfaceType('ITest',ITest,'IUnknown',IUnknown,H);
RegisterInterfaceMethod(ITest, 'procedure Proc(A: Integer); overload;');

RegisterMethod

Registeres a method of Delphi class.
procedure RegisterMethod(PClass: TClass; const Header: String; Address: Pointer);

Arguments

PClass
A Delphi class.
Header
Header of method.
Address
Address of method.

Example

initialization
..........................
RegisterMethod(TStringList, 'procedure Clear; override;', @TStringList.Clear);

The method becomes available for all TPaxScripter instances.

See Also

RegisterBCBMethod

Registeres method of a C++ Builder defined class.
procedure RegisterBCBMethod(PClass: TClass; const Header: String; Address: Pointer);

Example

void __fastcall TForm1::Foo()
{
ShowMessage("Foo");
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
 void ( __closure __fastcall *pp)();
 pp = Foo;

 RegisterClassType(__classid(TForm1), -1);
 RegisterBCBMethod(__classid(TForm1), "procedure Foo;", &pp);
}

See Also

RegisterNamespace

Registeres namespace.
function RegisterNamespace(const Name: String; Owner: Integer = -1): Integer;

Arguments

Name
Name of the namespace.
Owner
Determines handle of namespace which contains given namespace.

Returns handle of the namespace.

Example

initialization
................................

H := RegisterNamespace('MyNamespace');
H := RegisterNamespace('MyNestedNamespace', H);

The namespace becomes available for all TPaxScripter instances.

RegisterProperty

Registeres a property of Delphi class.
procedure RegisterProperty(PClass: TClass; const PropDef: String);

Arguments

PClass
A Delphi class.
PropDef
A property definition.

Example

initialization
..........................................

RegisterMethod(TList, 'function Get(Index: Integer): Pointer;', @TList_Get, Fake);
RegisterMethod(TList, 'procedure Put(Index: Integer; Item: Pointer);', @TList_Put, Fake);
RegisterProperty(TList, 'property Items[Index: Integer]: Pointer read Get write Put; default;');

The property becomes available for all TPaxScripter instances.

RegisterRecordType

Allows you to register a record type defined in your Delphi application.
function RegisterRecordType(const TypeName: String;
                            Size: Integer;
                            OwnerIndex: Integer = -1): Integer;

Arguments

TypeName
Name of the type
Size
Size of the type
OwnerIndex
Index of namespace which contains the record type.

Example

Click here

RegisterRecordField

Allows you to register a field of the record type.
procedure RegisterRecordField(OwnerIndex: Integer; const FieldName, FieldType: String;
                              Offset: Integer): Integer;

Arguments

OwnerIndex
Index of the record type.
FieldName
Name of field
FieldType
Type of field
Offset
Offset of field.

Example

Click here.

RegisterRoutine

Registeres a global procedure or function.
procedure RegisterRoutine(const Header: String; Address: Pointer; Owner: Integer = -1);

Arguments

Header
Header of the procedure or function.
Owner
Determines handle of namespace which contains given procedure or function.

Example

Delphi:

RegisterRoutine('function GetStrTime: String;', @GetStrTime, -1);

C++ Builder:

AnsiString GetStrTime() {
  return DateTimeToStr(Now());
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  RegisterRoutine("function GetStrTime: String; cdecl;", GetStrTime, -1);
}

The function becomes available for all TPaxScripter instances.


Copyright © 1999-2006 VIRT Laboratory. All rights reserved.