Server Item Creation
One of the services that the server provides to the container is document creation. MFC delegates this responsibility to COleServerDoc::OnGetEmbeddedItem(). Your COleServerDoc derived class must override this factory method to create instances of your server items, as shown in Example 22.
Example 22 – Creating server items
COleServerItem* CMyAppDoc::OnGetEmbeddedItem()
{
// OnGetEmbeddedItem is called by the framework to get
// the ColeServerItem that is associated with the
// document. It is only called when necessary.
 
CMyAppSrvrItem* pItem = new CMyAppSrvrItem(this);
ASSERT_VALID(pItem);
return pItem;
}