1、注册dll
D:\>C:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm STTextEditor.dll /tlb:STTextEditor.tlb2、导入类型库
delphiproject-->import type Library...-->定位到STTextEditor(Version 1.0)-->Create Unit3、测试代码:
procedure TForm1.Button1Click(Sender: TObject);
var
  t1:TTextEditorControl;
begin
  t1 := TTextEditorControl.Create(nil);
  with t1 do
  try
    parent := Form1;
    Top := 10;
    Left := 10;
    Width := 400;
    Height := 300;
  finally
    free;
  end;
end;像上面这样操作之后,就出错了,编译的时候提示
[Error] Unit1.pas(32): Incompatible types: '_Control' and 'TForm1'
请帮忙看看

解决方案 »

  1.   

    不好意思,后面又改过一下:procedure TForm1.Button1Click(Sender: TObject); 
    var 
      t1:TTextEditorControl; 
    begin 
      t1 := TTextEditorControl.Create(Form1); 
      with t1 do 
      begin
        parent := Form1; 
        Top := 10; 
        Left := 10; 
        Width := 400; 
        Height := 300; 
      end;
    end; 
      

  2.   

      _Control = interface(IDispatch)
        ['{83ACBFAE-1A16-33EB-ABA0-BA8DF0B206D7}']
      end;  IDispatch = interface(IUnknown)
        ['{00020400-0000-0000-C000-000000000046}']
        function GetTypeInfoCount(out Count: Integer): HResult; stdcall;
        function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall;
        function GetIDsOfNames(const IID: TGUID; Names: Pointer;
          NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall;
        function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
          Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall;
      end;  IUnknown = interface
        ['{00000000-0000-0000-C000-000000000046}']
        function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
        function _AddRef: Integer; stdcall;
        function _Release: Integer; stdcall;
      end;
      

  3.   

    如果把.parent:=form1;去掉,程序就不报错了,但是界面上什么都显示不出来。