void CChildFrame::OnPortCreate( UINT nID ) { int portIndex = nID - ID_RESOURCE_PORT_BEGIN; Factory * pFactory = Port::portFactory( portIndex ); ASSERT( pFactory ); Port * pDoc = dynamic_cast<Port *>( pFactory->createWidget() ); ASSERT( pDoc ); pDoc->SetModifiedFlag(); pDoc->SetTitle( CString("New ") + pFactory->className() ); pDoc->createView(); }