zw84611兄你好﹕
我的問題還沒有解決﹐我要FindClass的類是在一個bpl文件中﹐我要創建這個類時才用
LoadPackage把這個bpl文件調入再用FindClass返回一個類再創建該類具體代嗎如下﹕
type
TMYForm= class of TForm;
TForm1 = class(TForm)
........................
procedure TForm1.Button1Click(Sender: TObject);
var FBasemodClass :TMYForm;
begin
FCurrentModuleHandle:=LoadPackage('Package1.bpl');
FBasemodClass:=TMYForm(FindClass('TForm2'));
Fform:=FBasemodClass.Create(self);
Fform.Show;
end;
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm2 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
initialization
RegisterClass(TForm2);
finalization
UnregisterClass(TForm2);
end.