读书人

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

发布时间: 2012-04-14 17:14:21 作者: rapoo

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

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两次

读书人网 >.NET

热点推荐