function CreateFormByClassName(const ClassName: string;vmaimfrom:string): TCustomForm;
var
AClass: TPersistentClass;
begin
{ Note that TApplication "owns" this form and thus it must be freed prior
to unloading the package }
AClass := GetClass(ClassName);
if AClass <> nil then
Result := TComponentClass(AClass).Create(TCustomForm(GetClass(vmaimfrom))) as TCustomForm //此句提示不能建立窗体,
else
raise Exception.CreateFmt(sErrorCreateForm, [ClassName]);
end;
function ShowModalFormByClassName(const ClassName: string;vmaimfrom:string): integer;
var
frm: TCustomForm;
begin
frm := CreateFormByClassName(ClassName);
try
Result := frm.Show;
finally
frm.Release
end;
end;