delphi7 Cannot assign a TFont to a TFont问题

来源:互联网 发布:深圳中医诊所知乎 编辑:程序博客网 时间:2024/05/22 22:56

头些天需要把 程序写成DLL来给其他人使用!!

 

在生成以后,调用发现程序提示这个错误 Cannot   assign   a   TFont   to   a   TFont  百思不得其解。

 

上网找了很多这方面的文章 解决方法大概就以下几类

 

1.深度赋值(我是没看明白什么)

 

2.带包编译(菜单Project-options-packages- 把build with runtime packages 勾上 一般带vcl rtl这2个包编译就行):

 

这个方法是可以解决这个错误!但是需要在 dll和exe程序里都带包编译才行!

 

3.这个是我憋了3天看了N个别人写的DLL才发现的

 

就是我在编写dll 的时候 向dll里传递程序变量

procedure GzWageFrm(App:TApplication;src:TScreen;conn: ShortString;idx:Integer); stdcall;
begin

  Application:= App;
  Screen := Scr;  //这个变量引起的!!

end;

 

但我把他屏蔽掉以后 运行程序时又发现 DLL里的窗体和主程序里的窗体发生冲突!!

 

后来把DLL改成

procedure GzWageFrm(App:THandle;conn: ShortString;idx:Integer); stdcall;
begin

  Application.Handle:= App;

end;

 

问题解决了!!

 

希望能给部分朋友提供点帮助!!