|
static CRuntimeClass* PASCAL FromName(
LPCSTR
lpszClassName
);
static CRuntimeClass* PASCAL FromName(
LPCWSTR
lpszClassName
);
|
|
Copy Code
|
// This example creates an object if CMyClass is defined.
CRuntimeClass* pMyRTClass= pMyObject->GetRuntimeClass();
CRuntimeClass* pClass = pMyRTClass->FromName("CMyClass");
if (pClass == NULL)
{
// not found, display a warning for diagnostic purposes
AfxMessageBox("Warning: CMyClass not defined");
return NULL;
}
// attempt to create the object with the found CRuntimeClass
CObject* pObject = pClass->CreateObject();
|