我用delphi2009创建了好多控件的实例都没有出现过问题,以前创建的用Import Component导入都是单个类的,今天发现这个控件是包函多个类的,不知道是不是这个原因,创建其中一个类的实例就会出现不支持接口,是这个控件禁止创建实例,还是多类多接口的创建实例方法不一样,请高人指点。

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      ss:TSession2;
    begin
      ss:=TSession2.Create(nil);
      //上面这句就会失败,显示不支持此接口
    end;
      

  2.   

    你是在 activeX 调用么?
    如果是 在activeX 调用你需要在 Session2 里面写函数。比如 
    type
      
    var
      Session2: TSession2;
    Function ShowSession2;
    implementation
    {$R *.dfm}
    Function ShowSession2;
    begin
      try
        Session2 := TSession2.Create(nil);
      Except
      ...
      end;
    end;然后在 Form1 窗体里面调用 ShowSession2 这个函数