unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
  IOutForm = interface
    ['{3FDC0F96-2954-4DE4-A5AE-BE3C390C1046}'] //GUID
    procedure kk();
  end;type
  TForm1 = class(TForm,IOutForm)
  private
    { Private declarations }
    procedure kk();
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.DFM}{ TForm1 }procedure TForm1.kk;
begin
//
end;end.
多看看 com 方面的书!!!

解决方案 »

  1.   

    Type
    MyInterface=Interface
      procedure ShowM(s:String);0D
    end;MyComponent=Class(TComponent,MyInterface);
      procedure ShowM(s:String);0D
    en;
    procedure TComponent.ShowM(s:String);
    begin
      ShowMessage(s);
    en;—————————————————————————————————
    MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
                 毁誉由人,望天上云卷云舒,聚散任风。';
    if Not Assigned(I) then
      I := TI.Create(Nil);
    I.Maxim := MaximStr;
    I.Explain := '假如上述代码中出现“OA”、“3D”等字样,改为“=”或者去掉';
    I.Desire := '加不加分随你';
    —————————————————————————————————
        
      

  2.   

    unit Client;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, SConnect, Db, DBClient, CallBack2_TLB, MConnect, ComObj, ActiveX;
    type
      TClient = class(TAutoIntfObject,IClient)
      protected
        procedure Progress(RecNo, RecCount: integer; var Continue: WordBool); safecall;
        procedure Done; safecall;
      end;  TfrmClient = class(TForm)
        DCOMConnection1: TDCOMConnection;
        SocketConnection1: TSocketConnection;
        btnTraverse: TButton;
        lblProgress: TLabel;
        chkStop: TCheckBox;
        procedure btnTraverseClick(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        FClient : TClient;
      public
        { Public declarations }
        MyDispatchConnection: TDispatchConnection;
      end;var
      frmClient: TfrmClient;implementation{$R *.DFM}procedure TClient.Progress(RecNo, RecCount: integer; var Continue: WordBool); safecall;
    begin
      frmClient.lblProgress.Caption := Format('%d%d',[RecNo,RecCount]);
      Application.ProcessMessages;
      Continue := Not frmClient.chkStop.Checked;
    end;procedure TClient.Done;
    begin
      showmessage('asdf');
    end;procedure TfrmClient.btnTraverseClick(Sender: TObject);
    begin
      MyDispatchConnection.AppServer.TranversTable;
    end;procedure TfrmClient.FormCreate(Sender: TObject);
    var
      typelib: ITypeLib;
    begin
      MyDispatchConnection:=DCOMConnection1;
      MyDispatchConnection.Connected:=true;
      OleCheck(LoadRegTypeLib(LIBID_Callback2, 1, 0, 0, typelib));
      FClient:=TClient.Create(typelib, IClient);
      MyDispatchConnection.AppServer.SetCallback(FClient as IDispatch);
    end;在TClient = class(TAutoIntfObject,IClient)行报错:IClient没定义。