function TFrm_Main.Prf_RunListProc(As_FormName: string): Integer; var FcType: TFormClass; Frmname: string; begin try Frmname := 'T' + As_FormName; FcType := TFormClass(FindClass(Frmname));//-------这里报错 if Assigned(OpenWindow) then OpenWindow.Free; Application.CreateForm(Fctype, OpenWindow); OpenWindow.Showmodal; except ShowMessage('该功能目前无法使用!'); Result := -1; end; Result := 0; end;
Call FindClass to locate a class type by name. FindClass searches the classes that the streaming system knows about. Form classes and component classes that are referenced in a form declaration (instance variables) are automatically registered with the streaming system. Other classes can be registered (with a call to RegisterClasses) so that the streaming system will recognize that class in a stream and know how to construct it. 我没看怎么懂,好像是说,只能查找到系统的类,如果想查到其它的类必须要注册!
老兄我给你试过了 没有错误呀 你的openwindow是一个窗体吧?
In the unit declarationing TForm1initialization RegisterClass(TForm1);That is ok.
var
FcType: TFormClass;
Frmname: string;
begin
try
Frmname := 'T' + As_FormName;
FcType := TFormClass(FindClass(Frmname));//-------这里报错
if Assigned(OpenWindow) then
OpenWindow.Free;
Application.CreateForm(Fctype, OpenWindow);
OpenWindow.Showmodal;
except
ShowMessage('该功能目前无法使用!');
Result := -1;
end;
Result := 0;
end;
我没看怎么懂,好像是说,只能查找到系统的类,如果想查到其它的类必须要注册!
没有错误呀
你的openwindow是一个窗体吧?
RegisterClass(TForm1);That is ok.