在DLL中引用VCL控件,报告错误!

解决方案 »

  1.   

    我是在DLL中,要创建一个TMemo组件,无法创建,原型如下:
    Procedure CreateMyTMemo(var tmpmemo:TMemo;Aowner:TComponent);
    var
        tmpfont : TFont ;
    begin
        tmpfont := TFont.Create ;
        tmpfont.Name := 'Ms Sans Serif';
        tmpfont.Size := 8;
        tmpmemo := TMemo.Create(Aowner);
        tmpmemo.Font.Assign(tmpfont);
    end;
    在应用程序中,如下调用
    var
       mymemo:TMemo;
    procedure TForm1.button1click(sender:TObject);
    begin
        CreateMyTMemo(mymemo,self);
    end;
    结果报
    Access violation at address 00000000 read at address 00000000
    请教高手,为什么不行呢?
      

  2.   

    Procedure CreateMyTMemo(var tmpmemo:TMemo;Aowner:TComponent);stdcall;
    这是必须的,
    然后再检查其他错误。