Solved

How to implement following event(s)

Posted on 2007-04-02
10
390 Views
Last Modified: 2010-04-04
I have the following type library and want to use the BeforeSaceDocument event. How do I implement the following section in my own project?

// *********************************************************************//
// DispIntf:  __Application
// Flags:     (4240) Hidden NonExtensible Dispatchable
// GUID:      {BD2EDF23-7E4F-498D-9A82-7D704260385D}
// *********************************************************************//
  __Application = dispinterface
    ['{BD2EDF23-7E4F-498D-9A82-7D704260385D}']
    procedure BeforeSaveDocument(iSaveAction: Smallint; var bCancel: WordBool); dispid 1;
    procedure AfterSaveDocument(iResult: Smallint); dispid 2;
    procedure BeforePrint(var bCancel: WordBool); dispid 3;
    procedure BeforePrintDocument(iPrintMethod: Smallint; iLayoutType: Smallint;
                                  const sLayoutFileName: WideString; var bCancel: WordBool); dispid 4;
    procedure BeforePreviewAction(iAction: Smallint; const sReference: WideString;
                                  iSource: Smallint; iLayoutType: Smallint;
                                  const sLayoutFileName: WideString; var bCancel: WordBool); dispid 5;
    procedure AfterOpenDocument; dispid 6;
    procedure BeforeConvertDocument(var iDestinationType: Smallint; var bCancel: WordBool); dispid 7;
    procedure AfterConvertDocument(var iResult: Smallint); dispid 8;
    procedure AfterNewDocument(iSource: Smallint); dispid 9;
    procedure BeforeRenameDocument(const sNewDocName: WideString; var bCancel: WordBool); dispid 10;
    procedure AfterRenameDocument(var iResult: Smallint); dispid 11;
    procedure BeforeDeleteDocument(iSource: Smallint; lDocID: Integer; var bCancel: WordBool); dispid 12;
    procedure AfterDeleteDocument(lDocID: Integer; iResult: Smallint); dispid 13;
    procedure AfterAppExit; dispid 14;
    procedure BeforeContactSelection(iType: Smallint; var iSource: Smallint); dispid 15;
    procedure AfterContactSelection(iType: Smallint); dispid 16;
    procedure BeforeShippingSelection(var bCancel: WordBool); dispid 17;
    procedure AfterShippingSelection(iResult: Smallint); dispid 18;
    procedure BeforeEmailRecipientSelection(iRecipientType: Smallint; var sToList: WideString;
                                            var sFrom: WideString; var sCCList: WideString;
                                            var sBCCList: WideString; var sSubject: WideString;
                                            var bSuppressQWAction: WordBool); dispid 19;
  end;

0
Comment
Question by:JeePeeTee
  • 6
  • 4
10 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 18835660
do you want to implement this interface or this is definition of interface you connect to
and you trying handle events?

ziolko.
0
 
LVL 4

Author Comment

by:JeePeeTee
ID: 18835759
Hi Ziolko,

I want to connect to and 'try' to handle this event.

JeePee
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18835890
you need to write wrapper component which will look like this:

  TMyEventsSink = class(TOleServer)
  private
    FOnBeforeSaveDocument: TBeforeSaveDocumentEvent;
    FIntf: __Application;
    function GetDefaultInterface: __Application;
  protected
    procedure InitServerData; override;
    procedure InvokeEvent(DispID: TDispID; var Params: TVariantArray); override;
  public
    procedure Connect; override;
    procedure ConnectTo(svrIntf: ISWbemSink);
    procedure Disconnect; override;
    property DefaultInterface: ISWbemSink read GetDefaultInterface;
  published
    property OnBeforeSaveDocument: TBeforeSaveDocumentEvent read FOnBeforeSaveDocument write FOnBeforeSaveDocument;
  end;


{ TMyEventsSink }

procedure TMyEventsSink.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then begin
    punk := GetServer;
    ConnectEvents(punk);
    Fintf := punk as ISWbemSink;
  end;
end;

procedure TMyEventsSink.ConnectTo(svrIntf: ISWbemSink);
begin
  Disconnect;
  FIntf := svrIntf;
  ConnectEvents(FIntf);
end;

procedure TMyEventsSink.Disconnect;
begin
  if Fintf <> nil then
  begin
    DisconnectEvents(FIntf);
    FIntf := nil;
  end;
end;

function TMyEventsSink.GetDefaultInterface: __Application;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

procedure TMyEventsSink.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{class guid}';
    IntfIID:   '{intf IID}';
    EventIID:  '{event intf IID}';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TMyEventsSink.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
begin
  case DispID of
    -1: Exit;  // DISPID_UNKNOWN
    1: if Assigned(FOnBeforeSaveDocument) then
         FOnBeforeSaveDocument(Self,
                        Params[0],
                        Params[1]);
  end; {case DispID}
end;

but better idea is to let delphi create event wrapper for you,
when you import COM library there should be check box
asking you to create event wrappers ('Generate component wrappers')

ziolko.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18835920
i missed this one:

type

TBeforeSaveDocumentEvent = procedure(Sender: TObject;iSaveAction: Smallint; var bCancel: WordBool) of
object;

ziolko.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18835934
one more thing __Application is dispinterface if corresponding interface has different name you have to use interface's name instead dispinterface

ziolko.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 4

Author Comment

by:JeePeeTee
ID: 18837184
Ziolko, thank so far.

This is the complete type library. How do I use this part and intercept the fired BeforeSaveDocumtentEvent in my code:

I already have the following:

var
  QWApp : _Application;


 if not Assigned(QWApp) then
    QWApp := GetActiveOleObject('QuoteWerks.Application') as _Application;

How to continue?


<<< Type lib from here===================================================
unit QuoteWerks_TLB;

// ************************************************************************ //
// WARNING                                                                    
// -------                                                                    
// The types declared in this file were generated from data read from a      
// Type Library. If this type library is explicitly or indirectly (via        
// another type library referring to this type library) re-imported, or the  
// 'Refresh' command of the Type Library Editor activated while editing the  
// Type Library, the contents of this file will be regenerated and all        
// manual modifications will be lost.                                        
// ************************************************************************ //

// PASTLWTR : 1.2
// File generated on 28-3-2007 16:57:19 from Type Library described below.

// ************************************************************************  //
// Type Lib: \\192.168.100.1\data\QUOTEW~1\qw4.exe (1)
// LIBID: {A612FADE-1457-11D8-862D-0002B387F5BC}
// LCID: 0
// Helpfile: \\192.168.100.1\data\QUOTEW~1\qw4.hlp
// HelpString: QuoteWerks 4.0
// DepndLst:
//   (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, OleServer, StdVCL, Variants;
 

// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:        
//   Type Libraries     : LIBID_xxxx                                      
//   CoClasses          : CLASS_xxxx                                      
//   DISPInterfaces     : DIID_xxxx                                      
//   Non-DISP interfaces: IID_xxxx                                        
// *********************************************************************//
const
  // TypeLibrary Major and minor versions
  QuoteWerksMajorVersion = 3;
  QuoteWerksMinorVersion = 3;

  LIBID_QuoteWerks: TGUID = '{A612FADE-1457-11D8-862D-0002B387F5BC}';

  IID__Application: TGUID = '{BF3F4613-AFF4-446A-AC43-C3662696FF48}';
  DIID___Application: TGUID = '{BD2EDF23-7E4F-498D-9A82-7D704260385D}';
  IID__ItemFunctions: TGUID = '{275257A4-7C43-11D9-862D-0002B387F5BC}';
  CLASS_ItemFunctions: TGUID = '{275257A5-7C43-11D9-862D-0002B387F5BC}';
  IID__DocFunctions: TGUID = '{ED13023F-2486-43EE-8A89-9EFF5611F8E0}';
  CLASS_DocFunctions: TGUID = '{275257A3-7C43-11D9-862D-0002B387F5BC}';
  IID__ProductDatabase: TGUID = '{2065B034-3D73-4707-A982-029AF8019BB8}';
  CLASS_ProductDatabase: TGUID = '{2752579F-7C43-11D9-862D-0002B387F5BC}';
  IID__ProductDatabases: TGUID = '{275257A0-7C43-11D9-862D-0002B387F5BC}';
  CLASS_ProductDatabases: TGUID = '{275257A1-7C43-11D9-862D-0002B387F5BC}';
  IID__User: TGUID = '{275257A6-7C43-11D9-862D-0002B387F5BC}';
  CLASS_User: TGUID = '{275257A7-7C43-11D9-862D-0002B387F5BC}';
  IID__Users: TGUID = '{275257A8-7C43-11D9-862D-0002B387F5BC}';
  CLASS_Users: TGUID = '{275257A9-7C43-11D9-862D-0002B387F5BC}';
  IID__ProductDatabaseField: TGUID = '{2752579B-7C43-11D9-862D-0002B387F5BC}';
  CLASS_ProductDatabaseField: TGUID = '{A612FAEA-1457-11D8-862D-0002B387F5BC}';
  IID__Fields: TGUID = '{2752579C-7C43-11D9-862D-0002B387F5BC}';
  CLASS_Fields: TGUID = '{2752579D-7C43-11D9-862D-0002B387F5BC}';
  IID__Column: TGUID = '{27525799-7C43-11D9-862D-0002B387F5BC}';
  CLASS_Column: TGUID = '{A612FAEE-1457-11D8-862D-0002B387F5BC}';
  IID__Columns: TGUID = '{2752579A-7C43-11D9-862D-0002B387F5BC}';
  CLASS_Columns: TGUID = '{A612FAF0-1457-11D8-862D-0002B387F5BC}';
  IID__ProcedureHooks: TGUID = '{57624B5A-261A-47E6-9281-DEE76D6F9191}';
  CLASS_ProcedureHooks: TGUID = '{E9F57769-3238-4614-8254-BD883EE34A84}';
  CLASS_Application: TGUID = '{275257B7-7C43-11D9-862D-0002B387F5BC}';

// *********************************************************************//
// Declaration of Enumerations defined in Type Library                    
// *********************************************************************//
// Constants for enum qwLineTypeConstants
type
  qwLineTypeConstants = TOleEnum;
const
  qwLineTypeProductService = $00000001;
  qwLineTypeComment = $00000002;
  qwLineTypeSubTotal = $00000004;
  qwLineTypeGroupHeader = $00000008;
  qwLineTypeRunningSubTotal = $00000010;
  qwLineTypePercentDiscount = $00000040;
  qwLineTypePercentCharge = $00000080;

// Constants for enum qwLineAttributeConstants
type
  qwLineAttributeConstants = TOleEnum;
const
  qwLineAttributeNone = $00000000;
  qwLineAttributeExclude = $00000001;
  qwLineAttributeHidePrice = $00000002;
  qwLineAttributeDontPrint = $00000004;
  qwLineAttributeGroupMember = $00000008;
  qwLineAttributeOption = $00000010;
  qwLineAttributeAltIsOverided = $00000020;
  qwLineAttributePrintPicture = $00000040;

// Constants for enum qwLDFLinkType
type
  qwLDFLinkType = TOleEnum;
const
  qwNative = $00000000;
  qwAccess = $00000001;
  qwTechData = $00000002;
  qwIngram = $00000003;
  qwMSSQL = $00000004;
  qwODBC = $00000005;
  qwOLEDB = $00000006;
  qwQuickBooks = $00000007;
  qwSalesforce = $00000008;
  qwExcel = $00000009;
  qwSYNNEX = $0000000A;

type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  _Application = interface;
  _ApplicationDisp = dispinterface;
  __Application = dispinterface;
  _ItemFunctions = interface;
  _ItemFunctionsDisp = dispinterface;
  _DocFunctions = interface;
  _DocFunctionsDisp = dispinterface;
  _ProductDatabase = interface;
  _ProductDatabaseDisp = dispinterface;
  _ProductDatabases = interface;
  _ProductDatabasesDisp = dispinterface;
  _User = interface;
  _UserDisp = dispinterface;
  _Users = interface;
  _UsersDisp = dispinterface;
  _ProductDatabaseField = interface;
  _ProductDatabaseFieldDisp = dispinterface;
  _Fields = interface;
  _FieldsDisp = dispinterface;
  _Column = interface;
  _ColumnDisp = dispinterface;
  _Columns = interface;
  _ColumnsDisp = dispinterface;
  _ProcedureHooks = interface;
  _ProcedureHooksDisp = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                      
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  ItemFunctions = _ItemFunctions;
  DocFunctions = _DocFunctions;
  ProductDatabase = _ProductDatabase;
  ProductDatabases = _ProductDatabases;
  User = _User;
  Users = _Users;
  ProductDatabaseField = _ProductDatabaseField;
  Fields = _Fields;
  Column = _Column;
  Columns = _Columns;
  ProcedureHooks = _ProcedureHooks;
  Application = _Application;


// *********************************************************************//
// Declaration of structures, unions and aliases.                        
// *********************************************************************//

  Application___v0 = _Application;
  DocFunctions___v0 = _DocFunctions;
  DocFunctions___v1 = _DocFunctions;
  ProductDatabase___v0 = _ProductDatabase;

// *********************************************************************//
// Interface: _Application
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {BF3F4613-AFF4-446A-AC43-C3662696FF48}
// *********************************************************************//
  _Application = interface(IDispatch)
    ['{BF3F4613-AFF4-446A-AC43-C3662696FF48}']
    function GetMacro(const sMacroName: WideString): WideString; safecall;
    function GetUserINIFileName(const sUserName: WideString): WideString; safecall;
    function RunCommandLineOption(const sCommandLineOption: WideString): WideString; safecall;
    procedure SetStatusBarMessage(const sMessage: WideString; bBeep: WordBool;
                                  bLogInHistory: WordBool); safecall;
    function Get_ProductDatabases: _ProductDatabases; safecall;
    function Get_DocFunctions: _DocFunctions; safecall;
    function Get_ItemFunctions: _ItemFunctions; safecall;
    function Get_InstallationPath: WideString; safecall;
    procedure Shutdown(bDoNotSaveChanges: WordBool); safecall;
    function Get_Users: _Users; safecall;
    function Get_VersionMajor: WideString; safecall;
    function Get_VersionMinor: WideString; safecall;
    property ProductDatabases: _ProductDatabases read Get_ProductDatabases;
    property DocFunctions: _DocFunctions read Get_DocFunctions;
    property ItemFunctions: _ItemFunctions read Get_ItemFunctions;
    property InstallationPath: WideString read Get_InstallationPath;
    property Users: _Users read Get_Users;
    property VersionMajor: WideString read Get_VersionMajor;
    property VersionMinor: WideString read Get_VersionMinor;
  end;

// *********************************************************************//
// DispIntf:  _ApplicationDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {BF3F4613-AFF4-446A-AC43-C3662696FF48}
// *********************************************************************//
  _ApplicationDisp = dispinterface
    ['{BF3F4613-AFF4-446A-AC43-C3662696FF48}']
    function GetMacro(const sMacroName: WideString): WideString; dispid 1610809435;
    function GetUserINIFileName(const sUserName: WideString): WideString; dispid 1610809436;
    function RunCommandLineOption(const sCommandLineOption: WideString): WideString; dispid 1610809437;
    procedure SetStatusBarMessage(const sMessage: WideString; bBeep: WordBool;
                                  bLogInHistory: WordBool); dispid 1610809438;
    property ProductDatabases: _ProductDatabases readonly dispid 1745027144;
    property DocFunctions: _DocFunctions readonly dispid 1745027143;
    property ItemFunctions: _ItemFunctions readonly dispid 1745027142;
    property InstallationPath: WideString readonly dispid 1745027141;
    procedure Shutdown(bDoNotSaveChanges: WordBool); dispid 1610809440;
    property Users: _Users readonly dispid 1745027140;
    property VersionMajor: WideString readonly dispid 1745027139;
    property VersionMinor: WideString readonly dispid 1745027138;
  end;

// *********************************************************************//
// DispIntf:  __Application
// Flags:     (4240) Hidden NonExtensible Dispatchable
// GUID:      {BD2EDF23-7E4F-498D-9A82-7D704260385D}
// *********************************************************************//
  __Application = dispinterface
    ['{BD2EDF23-7E4F-498D-9A82-7D704260385D}']
    procedure BeforeSaveDocument(iSaveAction: Smallint; var bCancel: WordBool); dispid 1;
    procedure AfterSaveDocument(iResult: Smallint); dispid 2;
    procedure BeforePrint(var bCancel: WordBool); dispid 3;
    procedure BeforePrintDocument(iPrintMethod: Smallint; iLayoutType: Smallint;
                                  const sLayoutFileName: WideString; var bCancel: WordBool); dispid 4;
    procedure BeforePreviewAction(iAction: Smallint; const sReference: WideString;
                                  iSource: Smallint; iLayoutType: Smallint;
                                  const sLayoutFileName: WideString; var bCancel: WordBool); dispid 5;
    procedure AfterOpenDocument; dispid 6;
    procedure BeforeConvertDocument(var iDestinationType: Smallint; var bCancel: WordBool); dispid 7;
    procedure AfterConvertDocument(var iResult: Smallint); dispid 8;
    procedure AfterNewDocument(iSource: Smallint); dispid 9;
    procedure BeforeRenameDocument(const sNewDocName: WideString; var bCancel: WordBool); dispid 10;
    procedure AfterRenameDocument(var iResult: Smallint); dispid 11;
    procedure BeforeDeleteDocument(iSource: Smallint; lDocID: Integer; var bCancel: WordBool); dispid 12;
    procedure AfterDeleteDocument(lDocID: Integer; iResult: Smallint); dispid 13;
    procedure AfterAppExit; dispid 14;
    procedure BeforeContactSelection(iType: Smallint; var iSource: Smallint); dispid 15;
    procedure AfterContactSelection(iType: Smallint); dispid 16;
    procedure BeforeShippingSelection(var bCancel: WordBool); dispid 17;
    procedure AfterShippingSelection(iResult: Smallint); dispid 18;
    procedure BeforeEmailRecipientSelection(iRecipientType: Smallint; var sToList: WideString;
                                            var sFrom: WideString; var sCCList: WideString;
                                            var sBCCList: WideString; var sSubject: WideString;
                                            var bSuppressQWAction: WordBool); dispid 19;
  end;

// *********************************************************************//
// Interface: _ItemFunctions
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A4-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ItemFunctions = interface(IDispatch)
    ['{275257A4-7C43-11D9-862D-0002B387F5BC}']
    function SLIBufferCopyFromMLIBuffer(iRow: Smallint): Smallint; safecall;
    function FindAndCopyProductsIntoMLIBuffer(const sVendorName: WideString;
                                              const sSearchField: WideString;
                                              const sOperator: WideString;
                                              const sSearchValue: WideString): Integer; safecall;
    function LineItemGetSelectedRows: WideString; safecall;
    function LineItemSetSelectedRows(const sRows: WideString): Smallint; safecall;
    function SLIBufferCopyFromRow(iRow: Smallint): Smallint; safecall;
    function SLIBufferSetValue(const sField: WideString; const sValue: WideString): Smallint; safecall;
    function LineItemGetValue(iRow: Smallint; const sField: WideString): WideString; safecall;
    function MLIBufferCount: Smallint; safecall;
    function SLIBufferCopyToMLIBuffer: Smallint; safecall;
    function LineItemSetValue(iRow: Smallint; const sField: WideString; const sValue: WideString): Smallint; safecall;
    function FindAndCopyProductIntoSLIBuffer(const sManufacturerPartNumber: WideString;
                                             const sVendorName: WideString): Integer; safecall;
    function MLIBufferAppendPaste: Smallint; safecall;
    procedure SLIBufferClear; safecall;
    procedure MLIBufferClear; safecall;
    function MLIBufferInsertPaste: Smallint; safecall;
    function MLIBufferPaste: Smallint; safecall;
    function LineItemCopySelectedToMLIBuffer: Smallint; safecall;
    function LineItemCutSelectedToMLIBuffer: Smallint; safecall;
    function LineItemRefreshDisplay: Smallint; safecall;
    function AddItemFromProductDatabase(const sManufacturerPartNumber: WideString;
                                        const sVendorName: WideString; dQuantity: Double;
                                        lItemAttributes: qwLineAttributeConstants): Smallint; safecall;
    function Get_LineItemCount: Smallint; safecall;
    function Get_LineItemsChanged: Smallint; safecall;
    function AddLineItemToDocumentEx(dQuantity: Double; const sDescription: WideString;
                                     dUnitCost: Double; dUnitPrice: Double; dUnitList: Double;
                                     const sPriceModifier: WideString;
                                     const sManufacturer: WideString;
                                     const sManufacturerPartNumber: WideString;
                                     const sVendor: WideString; const sTaxCode: WideString;
                                     lItemType: qwLineTypeConstants;
                                     lItemAttributes: qwLineAttributeConstants;
                                     bInsertFlag: WordBool; iInsertBeforeRow: Smallint): Smallint; safecall;
    function AddLineItemToDocument(dQuantity: Double; const sDescription: WideString;
                                   dUnitCost: Double; dUnitPrice: Double; dUnitList: Double;
                                   const sPriceModifier: WideString;
                                   const sManufacturer: WideString;
                                   const sManufacturerPartNumber: WideString;
                                   const sVendor: WideString; bTaxable: WordBool;
                                   lItemType: qwLineTypeConstants;
                                   lItemAttributes: qwLineAttributeConstants;
                                   bInsertFlag: WordBool; iInsertBeforeRow: Smallint): Smallint; safecall;
    function LineItemGetActiveRow: Smallint; safecall;
    function LineItemSetActiveRow(iRow: Smallint): Smallint; safecall;
    function SLIBufferGetValue(const sField: WideString): WideString; safecall;
    property LineItemCount: Smallint read Get_LineItemCount;
    property LineItemsChanged: Smallint read Get_LineItemsChanged;
  end;

// *********************************************************************//
// DispIntf:  _ItemFunctionsDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A4-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ItemFunctionsDisp = dispinterface
    ['{275257A4-7C43-11D9-862D-0002B387F5BC}']
    function SLIBufferCopyFromMLIBuffer(iRow: Smallint): Smallint; dispid 1610809346;
    function FindAndCopyProductsIntoMLIBuffer(const sVendorName: WideString;
                                              const sSearchField: WideString;
                                              const sOperator: WideString;
                                              const sSearchValue: WideString): Integer; dispid 1610809347;
    function LineItemGetSelectedRows: WideString; dispid 1610809348;
    function LineItemSetSelectedRows(const sRows: WideString): Smallint; dispid 1610809349;
    function SLIBufferCopyFromRow(iRow: Smallint): Smallint; dispid 1610809350;
    function SLIBufferSetValue(const sField: WideString; const sValue: WideString): Smallint; dispid 1610809351;
    function LineItemGetValue(iRow: Smallint; const sField: WideString): WideString; dispid 1610809352;
    function MLIBufferCount: Smallint; dispid 1610809353;
    function SLIBufferCopyToMLIBuffer: Smallint; dispid 1610809354;
    function LineItemSetValue(iRow: Smallint; const sField: WideString; const sValue: WideString): Smallint; dispid 1610809355;
    function FindAndCopyProductIntoSLIBuffer(const sManufacturerPartNumber: WideString;
                                             const sVendorName: WideString): Integer; dispid 1610809356;
    function MLIBufferAppendPaste: Smallint; dispid 1610809357;
    procedure SLIBufferClear; dispid 1610809358;
    procedure MLIBufferClear; dispid 1610809359;
    function MLIBufferInsertPaste: Smallint; dispid 1610809360;
    function MLIBufferPaste: Smallint; dispid 1610809361;
    function LineItemCopySelectedToMLIBuffer: Smallint; dispid 1610809362;
    function LineItemCutSelectedToMLIBuffer: Smallint; dispid 1610809363;
    function LineItemRefreshDisplay: Smallint; dispid 1610809364;
    function AddItemFromProductDatabase(const sManufacturerPartNumber: WideString;
                                        const sVendorName: WideString; dQuantity: Double;
                                        lItemAttributes: qwLineAttributeConstants): Smallint; dispid 1610809365;
    property LineItemCount: Smallint readonly dispid 1745027073;
    property LineItemsChanged: Smallint readonly dispid 1745027072;
    function AddLineItemToDocumentEx(dQuantity: Double; const sDescription: WideString;
                                     dUnitCost: Double; dUnitPrice: Double; dUnitList: Double;
                                     const sPriceModifier: WideString;
                                     const sManufacturer: WideString;
                                     const sManufacturerPartNumber: WideString;
                                     const sVendor: WideString; const sTaxCode: WideString;
                                     lItemType: qwLineTypeConstants;
                                     lItemAttributes: qwLineAttributeConstants;
                                     bInsertFlag: WordBool; iInsertBeforeRow: Smallint): Smallint; dispid 1610809366;
    function AddLineItemToDocument(dQuantity: Double; const sDescription: WideString;
                                   dUnitCost: Double; dUnitPrice: Double; dUnitList: Double;
                                   const sPriceModifier: WideString;
                                   const sManufacturer: WideString;
                                   const sManufacturerPartNumber: WideString;
                                   const sVendor: WideString; bTaxable: WordBool;
                                   lItemType: qwLineTypeConstants;
                                   lItemAttributes: qwLineAttributeConstants;
                                   bInsertFlag: WordBool; iInsertBeforeRow: Smallint): Smallint; dispid 1610809367;
    function LineItemGetActiveRow: Smallint; dispid 1610809368;
    function LineItemSetActiveRow(iRow: Smallint): Smallint; dispid 1610809369;
    function SLIBufferGetValue(const sField: WideString): WideString; dispid 1610809370;
  end;

// *********************************************************************//
// Interface: _DocFunctions
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {ED13023F-2486-43EE-8A89-9EFF5611F8E0}
// *********************************************************************//
  _DocFunctions = interface(IDispatch)
    ['{ED13023F-2486-43EE-8A89-9EFF5611F8E0}']
    function DocumentPrint(const sLayoutFileName: WideString; const sCoverPageFileName: WideString;
                           const sCoverPageMessageText: WideString; iPrintMethod: Smallint;
                           const sSpecSheetList: WideString; const sLiteratureList: WideString;
                           bPromptBeforePrintingPDFFiles: WordBool; const sPrinterName: WideString): Smallint; safecall;
    function DocumentRecalculate: Smallint; safecall;
    function DocumentClose: Smallint; safecall;
    function DocumentNew(const sDocType: WideString): Smallint; safecall;
    function DocumentNewFromTemplate(const sTemplateDocumentName: WideString): Smallint; safecall;
    function ExportToDTFFile(const sDocNo: WideString): Smallint; safecall;
    function SetActiveTab(iTab: Smallint): Smallint; safecall;
    function SetActiveDocumentIndex(iDocumentIndex: Smallint): Smallint; safecall;
    function RefreshDisplay: Smallint; safecall;
    function SetDocumentHeaderValue(const sValueName: WideString; vValue: OleVariant;
                                    bRefreshDisplay: WordBool): Smallint; safecall;
    function Get_DocumentChanged: Smallint; safecall;
    function Get_DocumentOpenCount: Smallint; safecall;
    function DocumentOpen(const sSearchField: WideString; SearchValue: OleVariant): Smallint; safecall;
    function GetDocumentHeaderValue(const sValueName: WideString): OleVariant; safecall;
    function Get_GetActiveDocumentIndex: Smallint; safecall;
    function DocumentInUseBy(const sDocNo: WideString): WideString; safecall;
    property DocumentChanged: Smallint read Get_DocumentChanged;
    property DocumentOpenCount: Smallint read Get_DocumentOpenCount;
    property GetActiveDocumentIndex: Smallint read Get_GetActiveDocumentIndex;
  end;

// *********************************************************************//
// DispIntf:  _DocFunctionsDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {ED13023F-2486-43EE-8A89-9EFF5611F8E0}
// *********************************************************************//
  _DocFunctionsDisp = dispinterface
    ['{ED13023F-2486-43EE-8A89-9EFF5611F8E0}']
    function DocumentPrint(const sLayoutFileName: WideString; const sCoverPageFileName: WideString;
                           const sCoverPageMessageText: WideString; iPrintMethod: Smallint;
                           const sSpecSheetList: WideString; const sLiteratureList: WideString;
                           bPromptBeforePrintingPDFFiles: WordBool; const sPrinterName: WideString): Smallint; dispid 1610809358;
    function DocumentRecalculate: Smallint; dispid 1610809347;
    function DocumentClose: Smallint; dispid 1610809348;
    function DocumentNew(const sDocType: WideString): Smallint; dispid 1610809349;
    function DocumentNewFromTemplate(const sTemplateDocumentName: WideString): Smallint; dispid 1610809350;
    function ExportToDTFFile(const sDocNo: WideString): Smallint; dispid 1610809351;
    function SetActiveTab(iTab: Smallint): Smallint; dispid 1610809352;
    function SetActiveDocumentIndex(iDocumentIndex: Smallint): Smallint; dispid 1610809353;
    function RefreshDisplay: Smallint; dispid 1610809354;
    function SetDocumentHeaderValue(const sValueName: WideString; vValue: OleVariant;
                                    bRefreshDisplay: WordBool): Smallint; dispid 1610809355;
    property DocumentChanged: Smallint readonly dispid 1745027074;
    property DocumentOpenCount: Smallint readonly dispid 1745027073;
    function DocumentOpen(const sSearchField: WideString; SearchValue: OleVariant): Smallint; dispid 1610809356;
    function GetDocumentHeaderValue(const sValueName: WideString): OleVariant; dispid 1610809357;
    property GetActiveDocumentIndex: Smallint readonly dispid 1745027072;
    function DocumentInUseBy(const sDocNo: WideString): WideString; dispid 1610809361;
  end;

// *********************************************************************//
// Interface: _ProductDatabase
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2065B034-3D73-4707-A982-029AF8019BB8}
// *********************************************************************//
  _ProductDatabase = interface(IDispatch)
    ['{2065B034-3D73-4707-A982-029AF8019BB8}']
    procedure Set_RecGUID(const Param1: WideString); safecall;
    function Get_RecGUID: WideString; safecall;
    procedure DbConnectionClose; safecall;
    function DbConnectionValidate: WordBool; safecall;
    function Get_Options: WideString; safecall;
    function Get_Provider: WideString; safecall;
    function Get_Arguments: WideString; safecall;
    function Get_SortOrder: Smallint; safecall;
    procedure Set_Server(const Param1: WideString); safecall;
    function Get_Server: WideString; safecall;
    function Get_Driver: WideString; safecall;
    function Get_DB: WideString; safecall;
    function Get_DSN: WideString; safecall;
    function Get_DataSource: WideString; safecall;
    function Get_UserPassword: WideString; safecall;
    function Get_UserID: WideString; safecall;
    function Get_LinkStatus: WideString; safecall;
    function Get_Columns: _Columns; safecall;
    procedure _Set_Columns(var Param1: _Columns); safecall;
    function Get_DbJoinClause: WideString; safecall;
    function Get_UseInCompare: WordBool; safecall;
    function Get_ComparisonTotal: Double; safecall;
    function Get_DbPassword: WideString; safecall;
    function Get_DbFoldersTable: WideString; safecall;
    function Get_DbProductsTable: WideString; safecall;
    function Get_LinkType: qwLDFLinkType; safecall;
    function Get_Fields: _Fields; safecall;
    procedure _Set_Fields(var Param1: _Fields); safecall;
    function Get_LinkSubType: WideString; safecall;
    function Get_DbExists: Smallint; safecall;
    function Get_Name: WideString; safecall;
    property RecGUID: WideString read Get_RecGUID write Set_RecGUID;
    property Options: WideString read Get_Options;
    property Provider: WideString read Get_Provider;
    property Arguments: WideString read Get_Arguments;
    property SortOrder: Smallint read Get_SortOrder;
    property Server: WideString read Get_Server write Set_Server;
    property Driver: WideString read Get_Driver;
    property DB: WideString read Get_DB;
    property DSN: WideString read Get_DSN;
    property DataSource: WideString read Get_DataSource;
    property UserPassword: WideString read Get_UserPassword;
    property UserID: WideString read Get_UserID;
    property LinkStatus: WideString read Get_LinkStatus;
    property Columns: _Columns read Get_Columns;
    property DbJoinClause: WideString read Get_DbJoinClause;
    property UseInCompare: WordBool read Get_UseInCompare;
    property ComparisonTotal: Double read Get_ComparisonTotal;
    property DbPassword: WideString read Get_DbPassword;
    property DbFoldersTable: WideString read Get_DbFoldersTable;
    property DbProductsTable: WideString read Get_DbProductsTable;
    property LinkType: qwLDFLinkType read Get_LinkType;
    property Fields: _Fields read Get_Fields;
    property LinkSubType: WideString read Get_LinkSubType;
    property DbExists: Smallint read Get_DbExists;
    property Name: WideString read Get_Name;
  end;

// *********************************************************************//
// DispIntf:  _ProductDatabaseDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2065B034-3D73-4707-A982-029AF8019BB8}
// *********************************************************************//
  _ProductDatabaseDisp = dispinterface
    ['{2065B034-3D73-4707-A982-029AF8019BB8}']
    property RecGUID: WideString dispid 1745027139;
    procedure DbConnectionClose; dispid 1610809404;
    function DbConnectionValidate: WordBool; dispid 1610809406;
    property Options: WideString readonly dispid 1745027130;
    property Provider: WideString readonly dispid 1745027129;
    property Arguments: WideString readonly dispid 1745027128;
    property SortOrder: Smallint readonly dispid 1745027127;
    property Server: WideString dispid 1745027126;
    property Driver: WideString readonly dispid 1745027125;
    property DB: WideString readonly dispid 1745027124;
    property DSN: WideString readonly dispid 1745027123;
    property DataSource: WideString readonly dispid 1745027122;
    property UserPassword: WideString readonly dispid 1745027121;
    property UserID: WideString readonly dispid 1745027120;
    property LinkStatus: WideString readonly dispid 1745027118;
    property Columns: _Columns dispid 1745027117;
    property DbJoinClause: WideString readonly dispid 1745027115;
    property UseInCompare: WordBool readonly dispid 1745027114;
    property ComparisonTotal: Double readonly dispid 1745027113;
    property DbPassword: WideString readonly dispid 1745027112;
    property DbFoldersTable: WideString readonly dispid 1745027111;
    property DbProductsTable: WideString readonly dispid 1745027110;
    property LinkType: qwLDFLinkType readonly dispid 1745027109;
    property Fields: _Fields dispid 1745027108;
    property LinkSubType: WideString readonly dispid 1745027105;
    property DbExists: Smallint readonly dispid 1745027106;
    property Name: WideString readonly dispid 0;
  end;

// *********************************************************************//
// Interface: _ProductDatabases
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A0-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ProductDatabases = interface(IDispatch)
    ['{275257A0-7C43-11D9-862D-0002B387F5BC}']
    function Count: Integer; safecall;
    function NewEnum: IUnknown; safecall;
    function Get_Item(var vntIndexKey: OleVariant): _ProductDatabase; safecall;
    property Item[var vntIndexKey: OleVariant]: _ProductDatabase read Get_Item; default;
  end;

// *********************************************************************//
// DispIntf:  _ProductDatabasesDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A0-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ProductDatabasesDisp = dispinterface
    ['{275257A0-7C43-11D9-862D-0002B387F5BC}']
    function Count: Integer; dispid 1610809354;
    function NewEnum: IUnknown; dispid -4;
    property Item[var vntIndexKey: OleVariant]: _ProductDatabase readonly dispid 0; default;
  end;

// *********************************************************************//
// Interface: _User
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A6-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _User = interface(IDispatch)
    ['{275257A6-7C43-11D9-862D-0002B387F5BC}']
    function Get_Name: WideString; safecall;
    property Name: WideString read Get_Name;
  end;

// *********************************************************************//
// DispIntf:  _UserDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A6-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _UserDisp = dispinterface
    ['{275257A6-7C43-11D9-862D-0002B387F5BC}']
    property Name: WideString readonly dispid 0;
  end;

// *********************************************************************//
// Interface: _Users
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A8-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _Users = interface(IDispatch)
    ['{275257A8-7C43-11D9-862D-0002B387F5BC}']
    function Count: Integer; safecall;
    function Get_Item(Index: OleVariant): _User; safecall;
    function Get_LoggedInUser: WideString; safecall;
    function NewEnum: IUnknown; safecall;
    property Item[Index: OleVariant]: _User read Get_Item; default;
    property LoggedInUser: WideString read Get_LoggedInUser;
  end;

// *********************************************************************//
// DispIntf:  _UsersDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {275257A8-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _UsersDisp = dispinterface
    ['{275257A8-7C43-11D9-862D-0002B387F5BC}']
    function Count: Integer; dispid 1610809347;
    property Item[Index: OleVariant]: _User readonly dispid 0; default;
    property LoggedInUser: WideString readonly dispid 1745027072;
    function NewEnum: IUnknown; dispid -4;
  end;

// *********************************************************************//
// Interface: _ProductDatabaseField
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2752579B-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ProductDatabaseField = interface(IDispatch)
    ['{2752579B-7C43-11D9-862D-0002B387F5BC}']
    function Get_DefaultTitle: WideString; safecall;
    function Get_Title: WideString; safecall;
    function Get_Size: Integer; safecall;
    function Get_MappedField: WideString; safecall;
    function Get_QuoteWerksField: WideString; safecall;
    property DefaultTitle: WideString read Get_DefaultTitle;
    property Title: WideString read Get_Title;
    property Size: Integer read Get_Size;
    property MappedField: WideString read Get_MappedField;
    property QuoteWerksField: WideString read Get_QuoteWerksField;
  end;

// *********************************************************************//
// DispIntf:  _ProductDatabaseFieldDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2752579B-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ProductDatabaseFieldDisp = dispinterface
    ['{2752579B-7C43-11D9-862D-0002B387F5BC}']
    property DefaultTitle: WideString readonly dispid 1745027080;
    property Title: WideString readonly dispid 1745027081;
    property Size: Integer readonly dispid 1745027079;
    property MappedField: WideString readonly dispid 1745027078;
    property QuoteWerksField: WideString readonly dispid 1745027077;
  end;

// *********************************************************************//
// Interface: _Fields
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2752579C-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _Fields = interface(IDispatch)
    ['{2752579C-7C43-11D9-862D-0002B387F5BC}']
    function Get_Item(var vntIndexKey: OleVariant): _ProductDatabaseField; safecall;
    function Get_Count: Integer; safecall;
    function Get_NewEnum: IUnknown; safecall;
    property Item[var vntIndexKey: OleVariant]: _ProductDatabaseField read Get_Item; default;
    property Count: Integer read Get_Count;
    property NewEnum: IUnknown read Get_NewEnum;
  end;

// *********************************************************************//
// DispIntf:  _FieldsDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2752579C-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _FieldsDisp = dispinterface
    ['{2752579C-7C43-11D9-862D-0002B387F5BC}']
    property Item[var vntIndexKey: OleVariant]: _ProductDatabaseField readonly dispid 0; default;
    property Count: Integer readonly dispid 1745027072;
    property NewEnum: IUnknown readonly dispid -4;
  end;

// *********************************************************************//
// Interface: _Column
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {27525799-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _Column = interface(IDispatch)
    ['{27525799-7C43-11D9-862D-0002B387F5BC}']
    function Get_QuoteWerksField: WideString; safecall;
    function Get_Width: Smallint; safecall;
    function Get_DBField: WideString; safecall;
    function Get_Title: WideString; safecall;
    property QuoteWerksField: WideString read Get_QuoteWerksField;
    property Width: Smallint read Get_Width;
    property DBField: WideString read Get_DBField;
    property Title: WideString read Get_Title;
  end;

// *********************************************************************//
// DispIntf:  _ColumnDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {27525799-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ColumnDisp = dispinterface
    ['{27525799-7C43-11D9-862D-0002B387F5BC}']
    property QuoteWerksField: WideString readonly dispid 1745027079;
    property Width: Smallint readonly dispid 1745027078;
    property DBField: WideString readonly dispid 1745027077;
    property Title: WideString readonly dispid 1745027076;
  end;

// *********************************************************************//
// Interface: _Columns
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2752579A-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _Columns = interface(IDispatch)
    ['{2752579A-7C43-11D9-862D-0002B387F5BC}']
    function Get_Item(var vntIndexKey: OleVariant): _Column; safecall;
    function Get_Count: Integer; safecall;
    function Get_NewEnum: IUnknown; safecall;
    property Item[var vntIndexKey: OleVariant]: _Column read Get_Item; default;
    property Count: Integer read Get_Count;
    property NewEnum: IUnknown read Get_NewEnum;
  end;

// *********************************************************************//
// DispIntf:  _ColumnsDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {2752579A-7C43-11D9-862D-0002B387F5BC}
// *********************************************************************//
  _ColumnsDisp = dispinterface
    ['{2752579A-7C43-11D9-862D-0002B387F5BC}']
    property Item[var vntIndexKey: OleVariant]: _Column readonly dispid 0; default;
    property Count: Integer readonly dispid 1745027073;
    property NewEnum: IUnknown readonly dispid -4;
  end;

// *********************************************************************//
// Interface: _ProcedureHooks
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {57624B5A-261A-47E6-9281-DEE76D6F9191}
// *********************************************************************//
  _ProcedureHooks = interface(IDispatch)
    ['{57624B5A-261A-47E6-9281-DEE76D6F9191}']
    procedure TranslateDataSourcesSyncRec; safecall;
  end;

// *********************************************************************//
// DispIntf:  _ProcedureHooksDisp
// Flags:     (4560) Hidden Dual NonExtensible OleAutomation Dispatchable
// GUID:      {57624B5A-261A-47E6-9281-DEE76D6F9191}
// *********************************************************************//
  _ProcedureHooksDisp = dispinterface
    ['{57624B5A-261A-47E6-9281-DEE76D6F9191}']
    procedure TranslateDataSourcesSyncRec; dispid 1610809344;
  end;

// *********************************************************************//
// The Class CoItemFunctions provides a Create and CreateRemote method to          
// create instances of the default interface _ItemFunctions exposed by              
// the CoClass ItemFunctions. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoItemFunctions = class
    class function Create: _ItemFunctions;
    class function CreateRemote(const MachineName: string): _ItemFunctions;
  end;

// *********************************************************************//
// The Class CoDocFunctions provides a Create and CreateRemote method to          
// create instances of the default interface _DocFunctions exposed by              
// the CoClass DocFunctions. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoDocFunctions = class
    class function Create: _DocFunctions;
    class function CreateRemote(const MachineName: string): _DocFunctions;
  end;

// *********************************************************************//
// The Class CoProductDatabase provides a Create and CreateRemote method to          
// create instances of the default interface _ProductDatabase exposed by              
// the CoClass ProductDatabase. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoProductDatabase = class
    class function Create: _ProductDatabase;
    class function CreateRemote(const MachineName: string): _ProductDatabase;
  end;

// *********************************************************************//
// The Class CoProductDatabases provides a Create and CreateRemote method to          
// create instances of the default interface _ProductDatabases exposed by              
// the CoClass ProductDatabases. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoProductDatabases = class
    class function Create: _ProductDatabases;
    class function CreateRemote(const MachineName: string): _ProductDatabases;
  end;

// *********************************************************************//
// The Class CoUser provides a Create and CreateRemote method to          
// create instances of the default interface _User exposed by              
// the CoClass User. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoUser = class
    class function Create: _User;
    class function CreateRemote(const MachineName: string): _User;
  end;

// *********************************************************************//
// The Class CoUsers provides a Create and CreateRemote method to          
// create instances of the default interface _Users exposed by              
// the CoClass Users. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoUsers = class
    class function Create: _Users;
    class function CreateRemote(const MachineName: string): _Users;
  end;

// *********************************************************************//
// The Class CoProductDatabaseField provides a Create and CreateRemote method to          
// create instances of the default interface _ProductDatabaseField exposed by              
// the CoClass ProductDatabaseField. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoProductDatabaseField = class
    class function Create: _ProductDatabaseField;
    class function CreateRemote(const MachineName: string): _ProductDatabaseField;
  end;

// *********************************************************************//
// The Class CoFields provides a Create and CreateRemote method to          
// create instances of the default interface _Fields exposed by              
// the CoClass Fields. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoFields = class
    class function Create: _Fields;
    class function CreateRemote(const MachineName: string): _Fields;
  end;

// *********************************************************************//
// The Class CoColumn provides a Create and CreateRemote method to          
// create instances of the default interface _Column exposed by              
// the CoClass Column. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoColumn = class
    class function Create: _Column;
    class function CreateRemote(const MachineName: string): _Column;
  end;

// *********************************************************************//
// The Class CoColumns provides a Create and CreateRemote method to          
// create instances of the default interface _Columns exposed by              
// the CoClass Columns. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoColumns = class
    class function Create: _Columns;
    class function CreateRemote(const MachineName: string): _Columns;
  end;

// *********************************************************************//
// The Class CoProcedureHooks provides a Create and CreateRemote method to          
// create instances of the default interface _ProcedureHooks exposed by              
// the CoClass ProcedureHooks. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoProcedureHooks = class
    class function Create: _ProcedureHooks;
    class function CreateRemote(const MachineName: string): _ProcedureHooks;
  end;

// *********************************************************************//
// The Class CoApplication provides a Create and CreateRemote method to          
// create instances of the default interface _Application exposed by              
// the CoClass Application. The functions are intended to be used by            
// clients wishing to automate the CoClass objects exposed by the        
// server of this typelibrary.                                            
// *********************************************************************//
  CoApplication = class
    class function Create: _Application;
    class function CreateRemote(const MachineName: string): _Application;
  end;

implementation

uses ComObj;

class function CoItemFunctions.Create: _ItemFunctions;
begin
  Result := CreateComObject(CLASS_ItemFunctions) as _ItemFunctions;
end;

class function CoItemFunctions.CreateRemote(const MachineName: string): _ItemFunctions;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_ItemFunctions) as _ItemFunctions;
end;

class function CoDocFunctions.Create: _DocFunctions;
begin
  Result := CreateComObject(CLASS_DocFunctions) as _DocFunctions;
end;

class function CoDocFunctions.CreateRemote(const MachineName: string): _DocFunctions;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_DocFunctions) as _DocFunctions;
end;

class function CoProductDatabase.Create: _ProductDatabase;
begin
  Result := CreateComObject(CLASS_ProductDatabase) as _ProductDatabase;
end;

class function CoProductDatabase.CreateRemote(const MachineName: string): _ProductDatabase;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_ProductDatabase) as _ProductDatabase;
end;

class function CoProductDatabases.Create: _ProductDatabases;
begin
  Result := CreateComObject(CLASS_ProductDatabases) as _ProductDatabases;
end;

class function CoProductDatabases.CreateRemote(const MachineName: string): _ProductDatabases;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_ProductDatabases) as _ProductDatabases;
end;

class function CoUser.Create: _User;
begin
  Result := CreateComObject(CLASS_User) as _User;
end;

class function CoUser.CreateRemote(const MachineName: string): _User;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_User) as _User;
end;

class function CoUsers.Create: _Users;
begin
  Result := CreateComObject(CLASS_Users) as _Users;
end;

class function CoUsers.CreateRemote(const MachineName: string): _Users;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_Users) as _Users;
end;

class function CoProductDatabaseField.Create: _ProductDatabaseField;
begin
  Result := CreateComObject(CLASS_ProductDatabaseField) as _ProductDatabaseField;
end;

class function CoProductDatabaseField.CreateRemote(const MachineName: string): _ProductDatabaseField;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_ProductDatabaseField) as _ProductDatabaseField;
end;

class function CoFields.Create: _Fields;
begin
  Result := CreateComObject(CLASS_Fields) as _Fields;
end;

class function CoFields.CreateRemote(const MachineName: string): _Fields;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_Fields) as _Fields;
end;

class function CoColumn.Create: _Column;
begin
  Result := CreateComObject(CLASS_Column) as _Column;
end;

class function CoColumn.CreateRemote(const MachineName: string): _Column;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_Column) as _Column;
end;

class function CoColumns.Create: _Columns;
begin
  Result := CreateComObject(CLASS_Columns) as _Columns;
end;

class function CoColumns.CreateRemote(const MachineName: string): _Columns;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_Columns) as _Columns;
end;

class function CoProcedureHooks.Create: _ProcedureHooks;
begin
  Result := CreateComObject(CLASS_ProcedureHooks) as _ProcedureHooks;
end;

class function CoProcedureHooks.CreateRemote(const MachineName: string): _ProcedureHooks;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_ProcedureHooks) as _ProcedureHooks;
end;

class function CoApplication.Create: _Application;
begin
  Result := CreateComObject(CLASS_Application) as _Application;
end;

class function CoApplication.CreateRemote(const MachineName: string): _Application;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_Application) as _Application;
end;

end.
0
 
LVL 4

Author Comment

by:JeePeeTee
ID: 18863272
Any news for me Ziolko?
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18864000
sorry man for not going back to you i was pretty busy,
i'll post some code this weekend.

ziolko.
0
 
LVL 21

Accepted Solution

by:
ziolko earned 500 total points
ID: 18867144
here's wrapper component for _Application interface with events,
use it as normal object if you want call one of _Application
methods do it like this:

var app: T_Application;

app := T_Application.Create(nil);
app.DefaultInterface.GetMacro('some_macro_name')


unit Unit3;

interface

uses ActiveX, OleServer, Classes, Unit2;

type

  TOnBeforeSaveDocument = procedure(ASender: TObject;iSaveAction: Smallint; var bCancel: WordBool) of object;
  TOnAfterSaveDocument = procedure(ASender: TObject;iResult: Smallint) of object;
  TOnBeforePrint = procedure(ASender: TObject;var bCancel: WordBool) of object;
  TOnBeforePrintDocument = procedure(ASender: TObject;iPrintMethod: Smallint; iLayoutType: Smallint;
                                  const sLayoutFileName: WideString; var bCancel: WordBool) of object;
  TOnBeforePreviewAction = procedure(ASender: TObject;iAction: Smallint; const sReference: WideString;
                                  iSource: Smallint; iLayoutType: Smallint;
                                  const sLayoutFileName: WideString; var bCancel: WordBool) of object;
  TOnAfterOpenDocument = procedure(ASender: TObject) of object;
  TOnBeforeConvertDocument = procedure(ASender: TObject;var iDestinationType: Smallint; var bCancel: WordBool) of object;
  TOnAfterConvertDOcument = procedure(ASender: TObject;var iResult: Smallint) of object;
  TOnAfterNewDocument = procedure(ASender: TObject;iSource: Smallint) of object;
  TOnBeforeRenameDocument = procedure(ASender: TObject;const sNewDocName: WideString; var bCancel: WordBool) of object;
  TOnAfterRenameDocument = procedure(ASender: TObject;var iResult: Smallint) of object;
  TOnBeforeDeleteDocument = procedure(ASender: TObject;iSource: Smallint; lDocID: Integer; var bCancel: WordBool) of object;
  TOnAfterDeleteDocument = procedure(ASender: TObject;lDocID: Integer; iResult: Smallint) of object;
  TOnAfterAppExit = procedure(ASender: TObject) of object;
  TOnBeforeContactSelection = procedure(ASender: TObject;iType: Smallint; var iSource: Smallint) of object;
  TOnAfterContactSelection = procedure(ASender: TObject;iType: Smallint) of object;
  TOnBeforeShippingSelection = procedure(ASender: TObject;var bCancel: WordBool) of object;
  TOnAfterShippingSelection = procedure(ASender: TObject;iResult: Smallint) of object;
  TOnBeforeEmailRecipientSelection = procedure(ASender: TObject;iRecipientType: Smallint; var sToList: WideString;
                                            var sFrom: WideString; var sCCList: WideString;
                                            var sBCCList: WideString; var sSubject: WideString;
                                            var bSuppressQWAction: WordBool) of object;

  T_Application = class(TOleServer)
  private
    FOnBeforeSaveDocument: TOnBeforeSaveDocument;
    FOnAfterSaveDocument: TOnAfterSaveDocument;
    FOnBeforePrint: TOnBeforePrint;
    FOnBeforePrintDocument: TOnBeforePrintDocument;
    FOnBeforePreviewAction: TOnBeforePreviewAction;
    FOnAfterOpenDocument: TOnAfterOpenDocument;
    FOnBeforeConvertDocument: TOnBeforeConvertDocument;
    FOnAfterConvertDOcument: TOnAfterConvertDOcument;
    FOnAfterNewDocument: TOnAfterNewDocument;
    FOnBeforeRenameDocument: TOnBeforeRenameDocument;
    FOnAfterRenameDocument: TOnAfterRenameDocument;
    FOnBeforeDeleteDocument: TOnBeforeDeleteDocument;
    FOnAfterDeleteDocument: TOnAfterDeleteDocument;
    FOnAfterAppExit: TOnAfterAppExit;
    FOnBeforeContactSelection: TOnBeforeContactSelection;
    FOnAfterContactSelection: TOnAfterContactSelection;
    FOnBeforeShippingSelection: TOnBeforeShippingSelection;
    FOnAfterShippingSelection: TOnAfterShippingSelection;
    FOnBeforeEmailRecipientSelection: TOnBeforeEmailRecipientSelection;
    FIntf: _Application;
    function GetDefaultInterface: _Application;
  protected
    procedure InitServerData; override;
    procedure InvokeEvent(DispID: TDispID; var Params: TVariantArray); override;
  public
    procedure Connect; override;
    procedure ConnectTo(svrIntf: _Application);
    procedure Disconnect; override;
    property DefaultInterface: _Application read GetDefaultInterface;
    property OnBeforeSaveDocument: TOnBeforeSaveDocument read FOnBeforeSaveDocument write FOnBeforeSaveDocument;
    property OnAfterSaveDocument: TOnAfterSaveDocument read FOnAfterSaveDocument write FOnAfterSaveDocument;
    property OnBeforePrint: TOnBeforePrint read FOnBeforePrint write FOnBeforePrint;
    property OnBeforePrintDocument: TOnBeforePrintDocument read FOnBeforePrintDocument write FOnBeforePrintDocument;
    property OnBeforePreviewAction: TOnBeforePreviewAction read FOnBeforePreviewAction write FOnBeforePreviewAction;
    property OnAfterOpenDocument: TOnAfterOpenDocument read FOnAfterOpenDocument write FOnAfterOpenDocument;
    property OnBeforeConvertDocument: TOnBeforeConvertDocument read FOnBeforeConvertDocument write FOnBeforeConvertDocument;
    property OnAfterConvertDOcument: TOnAfterConvertDOcument read FOnAfterConvertDOcument write FOnAfterConvertDOcument;
    property OnAfterNewDocument: TOnAfterNewDocument read FOnAfterNewDocument write FOnAfterNewDocument;
    property OnBeforeRenameDocument: TOnBeforeRenameDocument read FOnBeforeRenameDocument write FOnBeforeRenameDocument;
    property OnAfterRenameDocument: TOnAfterRenameDocument read FOnAfterRenameDocument write FOnAfterRenameDocument;
    property OnBeforeDeleteDocument: TOnBeforeDeleteDocument read FOnBeforeDeleteDocument write FOnBeforeDeleteDocument;
    property OnAfterDeleteDocument: TOnAfterDeleteDocument read FOnAfterDeleteDocument write FOnAfterDeleteDocument;
    property OnAfterAppExit: TOnAfterAppExit read FOnAfterAppExit write FOnAfterAppExit;
    property OnBeforeContactSelection: TOnBeforeContactSelection read FOnBeforeContactSelection write FOnBeforeContactSelection;
    property OnAfterContactSelection: TOnAfterContactSelection read FOnAfterContactSelection write FOnAfterContactSelection;
    property OnBeforeShippingSelection: TOnBeforeShippingSelection read FOnBeforeShippingSelection write FOnBeforeShippingSelection;
    property OnAfterShippingSelection: TOnAfterShippingSelection read FOnAfterShippingSelection write FOnAfterShippingSelection;
    property OnBeforeEmailRecipientSelection: TOnBeforeEmailRecipientSelection read FOnBeforeEmailRecipientSelection write FOnBeforeEmailRecipientSelection;
  end;


implementation

{ T_Application }

procedure T_Application.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then begin
    punk := GetServer;
    ConnectEvents(punk);
    Fintf := punk as _Application;
  end;
end;

procedure T_Application.ConnectTo(svrIntf: _Application);
begin
  Disconnect;
  FIntf := svrIntf;
  ConnectEvents(FIntf);
end;

procedure T_Application.Disconnect;
begin
  if Fintf <> nil then begin
    DisconnectEvents(FIntf);
    FIntf := nil;
  end;
end;

function T_Application.GetDefaultInterface: _Application;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

procedure T_Application.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{275257B7-7C43-11D9-862D-0002B387F5BC}';
    IntfIID:   '{BF3F4613-AFF4-446A-AC43-C3662696FF48}';
    EventIID:  '{BD2EDF23-7E4F-498D-9A82-7D704260385D}';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure T_Application.InvokeEvent(DispID: TDispID;
  var Params: TVariantArray);
begin
  case DispID of
    -1: Exit;  // DISPID_UNKNOWN
    1:         if Assigned(FOnBeforeSaveDocument) then
                  FOnBeforeSaveDocument(Self, Params[0], TVarData(Params[1]).VBoolean);
    2:         if Assigned(FOnAfterSaveDocument) then
                  FOnAfterSaveDocument(Self, Params[0]) ;
    3:         if Assigned(FOnBeforePrint) then
                  FOnBeforePrint(Self, TVarData(Params[0]).VBoolean);
    4:         if Assigned(FOnBeforePrintDocument) then
                  FOnBeforePrintDocument(Self, Params[0], Params[1], Params[2], TVarData(Params[3]).VBoolean);
    5:         if Assigned(FOnBeforePreviewAction) then
                  FOnBeforePreviewAction(Self, Params[0], Params[1], Params[2], Params[3], Params[4], TVarData(Params[5]).VBoolean);
    6:         if Assigned(FOnAfterOpenDocument) then
                  FOnAfterOpenDocument(Self);
    7:         if Assigned(FOnBeforeConvertDocument) then
                  FOnBeforeConvertDocument(Self, TVarData(Params[0]).VSmallInt, TVarData(Params[1]).VBoolean);
    8:         if Assigned(FOnAfterConvertDOcument) then
                  FOnAfterConvertDOcument(Self, TVarData(Params[0]).VSmallInt);
    9:         if Assigned(FOnAfterNewDocument) then
                  FOnAfterNewDocument(Self, Params[0]);
    10:        if Assigned(FOnBeforeRenameDocument) then
                  FOnBeforeRenameDocument(Self, Params[0], TVarData(Params[1]).VBoolean);
    11:        if Assigned(FOnAfterRenameDocument) then
                  FOnAfterRenameDocument(Self, TVarData(Params[0]).VSmallInt);
    12:        if Assigned(FOnBeforeDeleteDocument) then
                  FOnBeforeDeleteDocument(Self, Params[0], Params[1], TVarData(Params[2]).VBoolean);
    13:        if Assigned(FOnAfterDeleteDocument) then
                  FOnAfterDeleteDocument(Self, Params[0], Params[1]);
    14:        if Assigned(FOnAfterAppExit) then
                  FOnAfterAppExit(Self);
    15:        if Assigned(FOnBeforeContactSelection) then
                  FOnBeforeContactSelection(Self, Params[0], TVarData(Params[1]).VSmallInt);
    16:        if Assigned(FOnAfterContactSelection) then
                  FOnAfterContactSelection(Self, Params[0]);
    17:        if Assigned(FOnBeforeShippingSelection) then
                  FOnBeforeShippingSelection(Self, TVarData(Params[0]).VBoolean);
    18:        if Assigned(FOnAfterShippingSelection) then
                  FOnAfterShippingSelection(Self, Params[0]);
    19:        if Assigned(FOnBeforeEmailRecipientSelection) then
                  FOnBeforeEmailRecipientSelection(Self, Params[0],
                                                         WideString((TVarData(Params[1]).VPointer)^),
                                                         WideString((TVarData(Params[2]).VPointer)^),
                                                         WideString((TVarData(Params[3]).VPointer)^),
                                                         WideString((TVarData(Params[4]).VPointer)^),
                                                         WideString((TVarData(Params[5]).VPointer)^),
                                                         TVarData(Params[6]).VBoolean);
  end; {case DispID}
end;

end.


ziolko.
0
 
LVL 4

Author Comment

by:JeePeeTee
ID: 18916510
Ziolko,

Thanks for your feedback. I'm working on it and will come back to this topic soon.

JeePee
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now