unit Scaner_TLB;

{ This file contains pascal declarations imported from a type library.
  This file will be written during each import or refresh of the type
  library editor.  Changes to this file will be discarded during the
  refresh process. }

{ ATOL: Driver Barcode Scaner }
{ Version 5.0 }

interface

uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;

const
  LIBID_Scaner: TGUID = '{30BDCD3D-FF71-46DD-931F-0C85D2FD6BFE}';

const

{ Component class GUIDs }
  Class_Scaner45: TGUID = '{691870D7-592F-11D3-B029-0000E8DBEDCE}';

type

{ Forward declarations: Interfaces }
  IStandart = interface;
  IStandartDisp = dispinterface;
  IScanerEvents = dispinterface;
  IScaner3 = interface;
  IScaner3Disp = dispinterface;

{ Forward declarations: CoClasses }
  Scaner45 = IScaner3;

{ :      }

  IStandart = interface(IDispatch)
    ['{9EE812C6-E98F-11D2-AF3E-0000E8DBEDCE}']
    function Get_ResultCode: Integer; safecall;
    function Get_ResultDescription: WideString; safecall;
    function Get_Version: WideString; safecall;
    function Get_CurrentDeviceIndex: Integer; safecall;
    procedure Set_CurrentDeviceIndex(Value: Integer); safecall;
    function Get_CurrentDeviceNumber: Integer; safecall;
    procedure Set_CurrentDeviceNumber(Value: Integer); safecall;
    function Get_CurrentDeviceName: WideString; safecall;
    procedure Set_CurrentDeviceName(const Value: WideString); safecall;
    function Get_DeviceCount: Integer; safecall;
    function Get_ApplicationHandle: Integer; safecall;
    procedure Set_ApplicationHandle(Value: Integer); safecall;
    function ShowProperties: Integer; safecall;
    function AddDevice: Integer; safecall;
    function DeleteDevice: Integer; safecall;
    property ResultCode: Integer read Get_ResultCode;
    property ResultDescription: WideString read Get_ResultDescription;
    property Version: WideString read Get_Version;
    property CurrentDeviceIndex: Integer read Get_CurrentDeviceIndex write Set_CurrentDeviceIndex;
    property CurrentDeviceNumber: Integer read Get_CurrentDeviceNumber write Set_CurrentDeviceNumber;
    property CurrentDeviceName: WideString read Get_CurrentDeviceName write Set_CurrentDeviceName;
    property DeviceCount: Integer read Get_DeviceCount;
    property ApplicationHandle: Integer read Get_ApplicationHandle write Set_ApplicationHandle;
  end;

{ DispInterface declaration for Dual Interface IStandart }

  IStandartDisp = dispinterface
    ['{9EE812C6-E98F-11D2-AF3E-0000E8DBEDCE}']
    property ResultCode: Integer readonly dispid 1;
    property ResultDescription: WideString readonly dispid 2;
    property Version: WideString readonly dispid 3;
    property CurrentDeviceIndex: Integer dispid 4;
    property CurrentDeviceNumber: Integer dispid 5;
    property CurrentDeviceName: WideString dispid 6;
    property DeviceCount: Integer readonly dispid 7;
    property ApplicationHandle: Integer dispid 8;
    function ShowProperties: Integer; dispid 9;
    function AddDevice: Integer; dispid 10;
    function DeleteDevice: Integer; dispid 11;
  end;

{ :     }

  IScanerEvents = dispinterface
    ['{691870D6-592F-11D3-B029-0000E8DBEDCE}']
    procedure DataEvent; dispid 1;
  end;

{ :    }

  IScaner3 = interface(IStandart)
    ['{691870D5-592F-11D3-B029-0000E8DBEDCE}']
    function Get_PortNumber: Integer; safecall;
    procedure Set_PortNumber(Value: Integer); safecall;
    function Get_BaudRate: Integer; safecall;
    procedure Set_BaudRate(Value: Integer); safecall;
    function Get_Parity: Integer; safecall;
    procedure Set_Parity(Value: Integer); safecall;
    function Get_DataBits: Integer; safecall;
    procedure Set_DataBits(Value: Integer); safecall;
    function Get_StopBits: Integer; safecall;
    procedure Set_StopBits(Value: Integer); safecall;
    function Get_StopFlag: Integer; safecall;
    procedure Set_StopFlag(Value: Integer); safecall;
    function Get_LockDevices: Integer; safecall;
    procedure Set_LockDevices(Value: Integer); safecall;
    function Get_DeviceDescription: WideString; safecall;
    function Get_DeviceEnabled: WordBool; safecall;
    procedure Set_DeviceEnabled(Value: WordBool); safecall;
    function Get_Model: Integer; safecall;
    procedure Set_Model(Value: Integer); safecall;
    function Get_AutoDisable: WordBool; safecall;
    procedure Set_AutoDisable(Value: WordBool); safecall;
    function Get_DataCount: Integer; safecall;
    function Get_DataEventEnabled: WordBool; safecall;
    procedure Set_DataEventEnabled(Value: WordBool); safecall;
    function Get_EventNumber: Integer; safecall;
    procedure Set_EventNumber(Value: Integer); safecall;
    function Get_ScanData: WideString; safecall;
    function Get_Track1: WideString; safecall;
    function Get_Track2: WideString; safecall;
    function Get_Track3: WideString; safecall;
    function Get_ClientType: Integer; safecall;
    function DeleteEvent: Integer; safecall;
    function Get_OldVersion: WordBool; safecall;
    procedure Set_OldVersion(Value: WordBool); safecall;
    procedure AboutBox; safecall;
    function Get_ApplicationTitle: WideString; safecall;
    procedure Set_ApplicationTitle(const Value: WideString); safecall;
    function Get_ModelGroup: Integer; safecall;
    function Get_RaiseException: WordBool; safecall;
    procedure Set_RaiseException(Value: WordBool); safecall;
    function Get_Sensitive: Integer; safecall;
    procedure Set_Sensitive(Value: Integer); safecall;
    function Get_Prefix: WideString; safecall;
    procedure Set_Prefix(const Value: WideString); safecall;
    function Get_Suffix: WideString; safecall;
    procedure Set_Suffix(const Value: WideString); safecall;
    function Get_IsDemo: WordBool; safecall;
    function Get_DriverDescription: WideString; safecall;
    function Get_PortDescription: WideString; safecall;
    property PortNumber: Integer read Get_PortNumber write Set_PortNumber;
    property BaudRate: Integer read Get_BaudRate write Set_BaudRate;
    property Parity: Integer read Get_Parity write Set_Parity;
    property DataBits: Integer read Get_DataBits write Set_DataBits;
    property StopBits: Integer read Get_StopBits write Set_StopBits;
    property StopFlag: Integer read Get_StopFlag write Set_StopFlag;
    property LockDevices: Integer read Get_LockDevices write Set_LockDevices;
    property DeviceDescription: WideString read Get_DeviceDescription;
    property DeviceEnabled: WordBool read Get_DeviceEnabled write Set_DeviceEnabled;
    property Model: Integer read Get_Model write Set_Model;
    property AutoDisable: WordBool read Get_AutoDisable write Set_AutoDisable;
    property DataCount: Integer read Get_DataCount;
    property DataEventEnabled: WordBool read Get_DataEventEnabled write Set_DataEventEnabled;
    property EventNumber: Integer read Get_EventNumber write Set_EventNumber;
    property ScanData: WideString read Get_ScanData;
    property Track1: WideString read Get_Track1;
    property Track2: WideString read Get_Track2;
    property Track3: WideString read Get_Track3;
    property ClientType: Integer read Get_ClientType;
    property OldVersion: WordBool read Get_OldVersion write Set_OldVersion;
    property ApplicationTitle: WideString read Get_ApplicationTitle write Set_ApplicationTitle;
    property ModelGroup: Integer read Get_ModelGroup;
    property RaiseException: WordBool read Get_RaiseException write Set_RaiseException;
    property Sensitive: Integer read Get_Sensitive write Set_Sensitive;
    property Prefix: WideString read Get_Prefix write Set_Prefix;
    property Suffix: WideString read Get_Suffix write Set_Suffix;
    property IsDemo: WordBool read Get_IsDemo;
    property DriverDescription: WideString read Get_DriverDescription;
    property PortDescription: WideString read Get_PortDescription;
  end;

{ DispInterface declaration for Dual Interface IScaner3 }

  IScaner3Disp = dispinterface
    ['{691870D5-592F-11D3-B029-0000E8DBEDCE}']
    property ResultCode: Integer readonly dispid 1;
    property ResultDescription: WideString readonly dispid 2;
    property Version: WideString readonly dispid 3;
    property CurrentDeviceIndex: Integer dispid 4;
    property CurrentDeviceNumber: Integer dispid 5;
    property CurrentDeviceName: WideString dispid 6;
    property DeviceCount: Integer readonly dispid 7;
    property ApplicationHandle: Integer dispid 8;
    function ShowProperties: Integer; dispid 9;
    function AddDevice: Integer; dispid 10;
    function DeleteDevice: Integer; dispid 11;
    property PortNumber: Integer dispid 12;
    property BaudRate: Integer dispid 13;
    property Parity: Integer dispid 14;
    property DataBits: Integer dispid 15;
    property StopBits: Integer dispid 16;
    property StopFlag: Integer dispid 17;
    property LockDevices: Integer dispid 18;
    property DeviceDescription: WideString readonly dispid 19;
    property DeviceEnabled: WordBool dispid 20;
    property Model: Integer dispid 21;
    property AutoDisable: WordBool dispid 22;
    property DataCount: Integer readonly dispid 23;
    property DataEventEnabled: WordBool dispid 24;
    property EventNumber: Integer dispid 25;
    property ScanData: WideString readonly dispid 26;
    property Track1: WideString readonly dispid 27;
    property Track2: WideString readonly dispid 28;
    property Track3: WideString readonly dispid 29;
    property ClientType: Integer readonly dispid 30;
    function DeleteEvent: Integer; dispid 31;
    property OldVersion: WordBool dispid 32;
    procedure AboutBox; dispid -552;
    property ApplicationTitle: WideString dispid 33;
    property ModelGroup: Integer readonly dispid 34;
    property RaiseException: WordBool dispid 35;
    property Sensitive: Integer dispid 301;
    property Prefix: WideString dispid 302;
    property Suffix: WideString dispid 303;
    property IsDemo: WordBool readonly dispid 304;
    property DriverDescription: WideString readonly dispid 305;
    property PortDescription: WideString readonly dispid 306;
  end;

{ :   - }

  TScaner45 = class(TOleControl)
  private
    FOnDataEvent: TNotifyEvent;
    FIntf: IScaner3;
    function GetControlInterface: IScaner3;
  protected
    procedure CreateControl;
    procedure InitControlData; override;
    function GetTOleEnumProp(Index: Integer): TOleEnum;
    procedure SetTOleEnumProp(Index: Integer; Value: TOleEnum);
  public
    function ShowProperties: Integer;
    function AddDevice: Integer;
    function DeleteDevice: Integer;
    function DeleteEvent: Integer;
    procedure AboutBox;
    property ControlInterface: IScaner3 read GetControlInterface;
    property ResultCode: Integer index 1 read GetIntegerProp;
    property ResultDescription: WideString index 2 read GetWideStringProp;
    property Version: WideString index 3 read GetWideStringProp;
    property DeviceCount: Integer index 7 read GetIntegerProp;
    property DeviceDescription: WideString index 19 read GetWideStringProp;
    property DataCount: Integer index 23 read GetIntegerProp;
    property ScanData: WideString index 26 read GetWideStringProp;
    property Track1: WideString index 27 read GetWideStringProp;
    property Track2: WideString index 28 read GetWideStringProp;
    property Track3: WideString index 29 read GetWideStringProp;
    property ClientType: Integer index 30 read GetIntegerProp;
    property ModelGroup: Integer index 34 read GetIntegerProp;
    property IsDemo: WordBool index 304 read GetWordBoolProp;
    property DriverDescription: WideString index 305 read GetWideStringProp;
    property PortDescription: WideString index 306 read GetWideStringProp;
  published
    property CurrentDeviceIndex: Integer index 4 read GetIntegerProp write SetIntegerProp stored False;
    property CurrentDeviceNumber: Integer index 5 read GetIntegerProp write SetIntegerProp stored False;
    property CurrentDeviceName: WideString index 6 read GetWideStringProp write SetWideStringProp stored False;
    property ApplicationHandle: Integer index 8 read GetIntegerProp write SetIntegerProp stored False;
    property PortNumber: Integer index 12 read GetIntegerProp write SetIntegerProp stored False;
    property BaudRate: Integer index 13 read GetIntegerProp write SetIntegerProp stored False;
    property Parity: Integer index 14 read GetIntegerProp write SetIntegerProp stored False;
    property DataBits: Integer index 15 read GetIntegerProp write SetIntegerProp stored False;
    property StopBits: Integer index 16 read GetIntegerProp write SetIntegerProp stored False;
    property StopFlag: Integer index 17 read GetIntegerProp write SetIntegerProp stored False;
    property LockDevices: Integer index 18 read GetIntegerProp write SetIntegerProp stored False;
    property DeviceEnabled: WordBool index 20 read GetWordBoolProp write SetWordBoolProp stored False;
    property Model: Integer index 21 read GetIntegerProp write SetIntegerProp stored False;
    property AutoDisable: WordBool index 22 read GetWordBoolProp write SetWordBoolProp stored False;
    property DataEventEnabled: WordBool index 24 read GetWordBoolProp write SetWordBoolProp stored False;
    property EventNumber: Integer index 25 read GetIntegerProp write SetIntegerProp stored False;
    property OldVersion: WordBool index 32 read GetWordBoolProp write SetWordBoolProp stored False;
    property ApplicationTitle: WideString index 33 read GetWideStringProp write SetWideStringProp stored False;
    property RaiseException: WordBool index 35 read GetWordBoolProp write SetWordBoolProp stored False;
    property Sensitive: Integer index 301 read GetIntegerProp write SetIntegerProp stored False;
    property Prefix: WideString index 302 read GetWideStringProp write SetWideStringProp stored False;
    property Suffix: WideString index 303 read GetWideStringProp write SetWideStringProp stored False;
    property OnDataEvent: TNotifyEvent read FOnDataEvent write FOnDataEvent;
  end;

procedure Register;

implementation

uses ComObj;

procedure TScaner45.InitControlData;
const
  CEventDispIDs: array[0..0] of Integer = (
    $00000001);
  CControlData: TControlData = (
    ClassID: '{691870D7-592F-11D3-B029-0000E8DBEDCE}';
    EventIID: '{691870D6-592F-11D3-B029-0000E8DBEDCE}';
    EventCount: 1;
    EventDispIDs: @CEventDispIDs;
    LicenseKey: nil;
    Flags: $00000000;
    Version: 300);
begin
  ControlData := @CControlData;
end;

procedure TScaner45.CreateControl;

  procedure DoCreate;
  begin
    FIntf := IUnknown(OleObject) as IScaner3;
  end;

begin
  if FIntf = nil then DoCreate;
end;

function TScaner45.GetControlInterface: IScaner3;
begin
  CreateControl;
  Result := FIntf;
end;

function TScaner45.GetTOleEnumProp(Index: Integer): TOleEnum;
begin
  Result := GetIntegerProp(Index);
end;

procedure TScaner45.SetTOleEnumProp(Index: Integer; Value: TOleEnum);
begin
  SetIntegerProp(Index, Value);
end;

function TScaner45.ShowProperties: Integer;
begin
  CreateControl;
  Result := FIntf.ShowProperties;
end;

function TScaner45.AddDevice: Integer;
begin
  CreateControl;
  Result := FIntf.AddDevice;
end;

function TScaner45.DeleteDevice: Integer;
begin
  CreateControl;
  Result := FIntf.DeleteDevice;
end;

function TScaner45.DeleteEvent: Integer;
begin
  CreateControl;
  Result := FIntf.DeleteEvent;
end;

procedure TScaner45.AboutBox;
begin
  CreateControl;
  FIntf.AboutBox;
end;


procedure Register;
begin
  RegisterComponents('ActiveX', [TScaner45]);
end;

end.
