TClass ClassRef; ListBox1->Clear(); ClassRef = Sender->ClassType(); while (ClassRef != NULL) { ListBox1->Items->Add(ClassRef->ClassName()); ClassRef = ClassRef->ClassParent(); };
#include <memory> //For STL auto_ptr class TMetaClass *MetaClass; void __fastcall TForm1::Button1Click(TObject *Sender) { std::auto_ptr<TClassFinder> myClassFinder(new TClassFinder(MetaClass, False)); TGraphicClass mygraphclass = (TGraphicClass) (myClassFinder->GetClass(Edit2->Text)); // TGraphicClass mygraphclass = (TGraphicClass) GetClass(Edit2->Text); Edit1->Text = GraphicExtension(mygraphclass); } __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { MetaClass = __classid(TIcon); // ico RegisterClasses(&MetaClass, 0); MetaClass = __classid(Graphics::TBitmap); // bmp RegisterClasses(&MetaClass, 0); MetaClass = __classid(TMetafile); // emf RegisterClasses(&MetaClass, 0); MetaClass = __classid(TShape); // no graphic extension RegisterClasses(&MetaClass, 0); MetaClass = __classid(TImage); // no graphic extension RegisterClasses(&MetaClass, 0); }
http://docwiki.embarcadero.com/CodeExamples/XE8/en/ClassesGetClass_%28C%2B%2B%29
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步