首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

这段代码会弹出两个窗体,应该怎么修改呢

2012-04-14 
这段代码会弹出两个窗体,应该如何修改呢?Delphi(Pascal) codeunit Unit1interfaceusesWindows, Messages,

这段代码会弹出两个窗体,应该如何修改呢?

Delphi(Pascal) code
unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, Menus,U_Myinterface;//在工程加入U_Myinterface这个unit,让exe也和bpl使用同一个接口。typeTmain = class(TForm)    MainMenu1: TMainMenu;    N1: TMenuItem;    bpl1: TMenuItem;    procedure bpl1Click(Sender: TObject);private    { Private declarations }public    { Public declarations }    my:Myinterface;end;varmain: Tmain;implementation{$R *.dfm}procedure Tmain.bpl1Click(Sender: TObject);varhModule: THandle;frm:TForm;beginhModule := LoadPackage('Plabel.bpl');       //动态载入包frm:=TForm(TComponentClass(FindClass('Tform1')).Create(Application)); //创建form,frm.ShowModal;          //show出来,如果需要用MDI方式,只需要把form的formstyle改了,然后用下面的代码即可my:=TComponentClass(FindClass('Tform1')).Create(Application) as Myinterface; //转化为接口my.show123('11');                                    //调用接口函数     end;end.


[解决办法]
my := frm as MyInterface;
[解决办法]
create两次

热点排行