Declare_DyncReate (MyDoc)
defined as
#define declare_dyncreate (Class_name) /
DECLARE_DYNAMIC (Class_name) /
Static COBJECT * PASCAL CREATEOBJECT ();
Equivalent to
Declare_Dynamic (MyDoc) /
Static COBJECT * PASCAL CREATEOBJECT ();
What is DECLARE_DYNAMIC?
defined as:
#define declare_dynamic (class_name) /
PUBLIC: /
Static const AFX_DATA CRUNTIMECLASS CLASS ## Class_name; /
Virtual cruntimeclass * getRuntimeClass () const; /
Then
Declare_Dynamic (MyDoc) /
Static COBJECT * PASCAL CREATEOBJECT ();
Equivalent to
PUBLIC: /
Static const AFX_DATA CRUNTIMECLASS Class ## mydoc; /
Virtual cruntimeclass * getRuntimeClass () const; /
Static COBJECT * PASCAL CREATEOBJECT ();
Then, according to
#define pascal __stdcall
#define AFX_CORE_DATA
#define AFX_DATA AFX_CORE_DATA
Explain that AFX_DATA is not
## is the connection character
Equivalent to
PUBLIC: /
Static const cantimeclass classmydoc; /
Virtual cruntimeclass * getRuntimeClass () const; /
Static cobject * __stdcall createObject ();
Then, according to
Struct cruntimeclass
{
// attributes
LPCSTR M_LPSZCLASSNAME;
INT m_nObjectsize;
Uint m_wschema; // Schema Number of the loading class
COBJECT * (Pascal * m_pfncreateObject) (); // null => Abstract Class
#ifdef _AFXDLL
Cruntimeclass * (Pascal * m_pfNgetBaseClass) ();
#ELSE
Cruntimeclass * m_pbaseclass;
#ENDIF
// Operations
COBJECT * CREATEOBJECT ();
Bool isderiveDFrom (const cruntimeclass * pbaseclass) const;
// Implementation
Void Store (CARCHIVE & AR) Const;
Static CruntimeClass * Pascal Load (CARCHIVE & Ar, Uint * Pwschemanum);
// CruntimeClass Objects Linked TOGETHER in Simple List
Cruntimeclass * m_pnextclass; // linked list of registered classes
}
Description CRUNTIMECLASS is a structure
Declare_DyncReate (MyDoc)
Be equivalent to
PUBLIC: /
Static const cantimeclass classmydoc; /
Virtual cruntimeclass * getRuntimeClass () const; / static cobject * __stdcall createObject ();
The three contents are defined, all of which are public members, a static structure, two functions.