Witam

Od dwóch tygodni usiłuję stworzyć obiekt automatyzacji w delphi. Umieszczam go w pliku dll. Tworze banalny serwer, który po wywołaniu funkcji wywołuje zdarzenie event. Projekt kompiluje się bez błędów. Rejestracja dll przy pomocy regsvr32.exe przebiega prawidłowo. Sprawdzenie obiektu wykonuje kodem napisanym w basic w word. Po wczytaniu pliku wyskakuje okienko dialogowe potwierdzające prawidłową pracę modułu.
Teraz kopiuje dll i plik worda na pena i przenoszę na innego kompa (bez zainstalowanego delphi). Rejestruje kontrolkę (wyświetlany jest komunikat że wszystko jest ok). Jednak przy odpaleniu pliku wywalany jest komunikat że nie można utworzyć obiektu. Nie mem pojęcia czemu się tak dzieje. Może ktoś ma jakieś pomysły? Proszę o pomoc.

Kod w Delphi

unit Main;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  ComObj, ActiveX, AxCtrls, Classes, com_serv_TLB, StdVcl;

type
  Tserver = class(TAutoObject, IConnectionPointContainer, Iserver)
  private
    { Private declarations }
    FConnectionPoints: TConnectionPoints;
    FConnectionPoint: TConnectionPoint;
    FEvents: IserverEvents;
    { note: FEvents maintains a *single* event sink. For access to more
      than one event sink, use FConnectionPoint.SinkList, and iterate
      through the list of sinks. }
  public
    procedure Initialize; override;
  protected
    { Protected declarations }
    property ConnectionPoints: TConnectionPoints read FConnectionPoints
      implements IConnectionPointContainer;
    procedure EventSinkChanged(const EventSink: IUnknown); override;
    function Get_Status: Integer; safecall;
    procedure ServRun; safecall;
  end;

implementation

uses ComServ;

var
  StatusCode : integer;


procedure Tserver.EventSinkChanged(const EventSink: IUnknown);
begin
  FEvents := EventSink as IserverEvents;
end;

procedure Tserver.Initialize;
begin
  inherited Initialize;
  FConnectionPoints := TConnectionPoints.Create(Self);
  if AutoFactory.EventTypeInfo <> nil then
    FConnectionPoint := FConnectionPoints.CreateConnectionPoint(
      AutoFactory.EventIID, ckSingle, EventConnect)
  else FConnectionPoint := nil;
end;


function Tserver.Get_Status: Integer;
begin
   Result := statusCode;
end;

procedure Tserver.ServRun;
begin
  statusCode :=1;
  if FEvents<>nil then
   begin
     StatusCode :=2;
     FEvents.onSignal;
   end;
end;

initialization
  TAutoObjectFactory.Create(ComServer, Tserver, Class_server,
    ciMultiInstance, tmApartment);
end.

Kod w Basicu


Option Explicit

Public WithEvents MyEvent As com_serv.server

Private Sub Document_Open()
    
    Dim x As Integer
    
    Set MyEvent = New com_serv.server
    
     If MyEvent Is Nothing Then Exit Sub

     MyEvent.ServRun
   
     x = MyEvent.Status
   
  If Not MyEvent Is Nothing Then
        Set MyEvent = Nothing
     End If
 End Sub

Private Sub MyEvent_onSignal()
MsgBox ("ss")
If Not MyEvent Is Nothing Then
     '   Set MyEvent = Nothing
    End If

End Sub