Sorry to be a nuisance,

I suspected that from the help you gave last time, however I still get the
error.
I am probably doing something stupid

My Unit 
-------

unit impTBoth;

interface

uses
  ComObj, ActiveX, TestBoth_TLB, StdVcl;

type
  TTIBoth = class(TAutoObject, ITIBoth)
  private
    FTime : string;
    FFreeThreadedMarshaler : IUnknown;
  protected
    function Get_TTime: WideString; safecall;
    procedure Set_TTime(const Value: WideString); safecall;
    procedure SetTime; safecall;
  public
    procedure AfterConstruction; override;
    Function ObjQueryInterface(const IID: TGUID; out Obj): HResult; virtual;
stdcall;
  end;

implementation

uses ComServ, SysUtils, windows;


procedure TTIBoth.AfterConstruction;
begin
  inherited;
  OleCheck( CoCreateFreeThreadedMarshaler( Self,  FFreeThreadedMarshaler ));
end;

function TTIBoth.ObjQueryInterface(const IID: TGUID; out Obj): HResult;
begin
  if GetInterface(IID, Obj) then Result := S_OK
  else Result := FFreeThreadedMarshaler.QueryInterface( IID, Obj );
end;

function TTIBoth.Get_TTime: WideString;
begin
  Get_TTime := FTime;
end;

procedure TTIBoth.Set_TTime(const Value: WideString);
begin
  FTime := Value;
end;

procedure TTIBoth.SetTime;
begin
    FTime := DateTimeToStr(Now);
end;

initialization
  TAutoObjectFactory.Create(ComServer, TTIBoth, Class_TIBoth,
    ciMultiInstance, tmBoth);

end.
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to