| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 
 |  
CView * CreateDynamicView(CRuntimeClass *pRuntimeView,
											  CDocument *pDocument,
											  CWnd * pParentWnd,
											  CFrameWnd* pParentFrame,
											  CRect viewRect,
											  UINT nIdView/*=1000*/,
  										  	  BOOL bBorder/*=FALSE*/,
											  BOOL bShow/*=TRUE*/)
{		 
	CView* pView = reinterpret_cast<CView*>(pRuntimeView->CreateObject());
    ASSERT(pView != NULL);
 
  	CCreateContext context;
   	context.m_pNewViewClass		= pRuntimeView;
   	context.m_pCurrentDoc		= pDocument;
   	context.m_pNewDocTemplate	= NULL;
   	context.m_pLastView			= NULL;
   	context.m_pCurrentFrame		= pParentFrame;
 
 
    if(!pView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,viewRect,
		 pParentWnd, nIdView, &context))
	{
   	   	TRACE0 ("System Error - Unable to create form view\n");
	   	return NULL;	  
	}
 
	if(bShow)
	{
		pView->SetWindowPos(NULL, 0, 0, 0, 0,
		                    SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
		pParentFrame->SetActiveView(pView);
	}
	else
		pView->SetWindowPos(NULL, 0, 0, 0, 0,
		                    SWP_HIDEWINDOW|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
 
	long style = ::GetWindowLong(pView->GetSafeHwnd(), GWL_STYLE);
	if(!bBorder)
		style &= ~WS_BORDER;
	else
		style |= WS_BORDER;
	::SetWindowLong(pView->GetSafeHwnd(), GWL_STYLE, style);
 
	pView->OnInitialUpdate();
	return pView;
} |