Beispiel #1
0
void 
CMainFrame::OnWindowNew3d() 
{
   CMDIChildWnd*  pActiveChild = MDIGetActive();
   CDocument* pDocument;
   
   if ( pActiveChild == NULL ||
      ( pDocument = pActiveChild->GetActiveDocument() ) == NULL ) 
   {
      TRACE("Warning:  No active document for WindowNew command\n");
      AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
      return; // Command failed
   }
   
   // Otherwise, we have a new frame!
   CDocTemplate* pTemplate = ((CDemoApp*)AfxGetApp())->m_pTemplate3dView;
   ASSERT_VALID( pTemplate );
   
   CFrameWnd* pFrame =
      pTemplate->CreateNewFrame( pDocument, pActiveChild );
   
   if (pFrame == NULL) 
   {
      TRACE( "Warning:  failed to create new frame\n" );
      AfxMessageBox( AFX_IDP_COMMAND_FAILURE );
      return; // Command failed
   }
   
   pTemplate->InitialUpdateFrame( pFrame, pDocument );

   ((CDemoDoc*)pDocument)->turnOnComputePoints();
}
void CMainFrame::MakeNewView( CRuntimeClass* pViewRuntimeClass)
{
	CDocument* pDocument;
	CChildFrame *pActiveChild;

	pActiveChild =(CChildFrame *)this->MDIGetActive();

	pDocument = this->GetCurrentDoc ();
/*
	if (pActiveChild == NULL ||
	  (pDocument = pActiveChild->GetActiveDocument()) == NULL)
	{
		TRACE0("Warning: No active document for WindowNew command.\n");
		AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
		return;     // command failed
	}
*/
	// otherwise we have a new frame !
	CDocTemplate* pTemplate = pDocument->GetDocTemplate();
	ASSERT_VALID(pTemplate);
	CFrameWnd* pFrame = CreateNewGameViewFrame(pViewRuntimeClass, pTemplate, pDocument, pActiveChild);
	if (pFrame == NULL)
	{
		TRACE0("Warning: failed to create new frame.\n");
		return;     // command failed
	}

	pTemplate->InitialUpdateFrame(pFrame, pDocument);
}
Beispiel #3
0
int OpenPocket(   const vector<CRossPocketItem>& UnitNos,
			  CString    Title) 
{

	CDocTemplate* tmpl = GetRossPocketTemplate();;

	CDocument* pDocument = tmpl->CreateNewDocument();

	if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return false;
	}

    ASSERT_VALID(pDocument);

	pDocument->m_bAutoDelete = FALSE;   // don't destroy if something goes wrong
	CFrameWnd* pFrame = tmpl->CreateNewFrame(pDocument, NULL);
	pDocument->m_bAutoDelete = TRUE;
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return FALSE;
	};

	ASSERT_VALID(pFrame);

	pDocument->SetPathName(CString("An entry subset by  ")+Title);
	

	// open an existing document
	tmpl->InitialUpdateFrame(pFrame, pDocument, TRUE);

	POSITION pos =  pDocument->GetFirstViewPosition();
	CPocketForm* V = (CPocketForm*)(pDocument->GetNextView(pos));
	V->m_PocketItems = UnitNos;
    V->m_WordList.InsertColumn(1,"Словарный вход", LVCFMT_LEFT, 200);
	V->m_WordList.InsertColumn(2,"Номер значения", LVCFMT_LEFT, 60);
	V->m_WordList.InsertColumn(2,"Название словаря", LVCFMT_LEFT, 60);
	V->m_WordList.SetItemCountEx(UnitNos.size());
	V->m_UnitsSize.Format ("Число словарных входов : %i",    V->m_WordList.GetItemCount());
    V->UpdateData(FALSE);
    V->m_WordList.UpdateData(FALSE);
    V->m_WordList.Invalidate();	
	V->m_Title = Title;

	// установка размеров
	V->GetParent()->SetWindowPos(NULL, 0,0, 535 , 500, SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOMOVE);
	return true;
};
Beispiel #4
0
void CMainFrame::OnButtonHomepage()
{
	// TODO:  在此添加命令处理程序代码
	CWinApp* pApp = AfxGetApp();

	// Get the correct document template.
	POSITION pos = pApp->GetFirstDocTemplatePosition();
	CDocTemplate* pDocTemplate = pApp->GetNextDocTemplate(pos);
	// Create a new frame.
	
	CFrameWnd* pFrame = pDocTemplate->CreateNewFrame(
		pDocTemplate->CreateNewDocument(),
		(CFrameWnd*)AfxGetMainWnd());
	// Activate the frame.
	pDocTemplate->InitialUpdateFrame(pFrame, NULL);
	CXiYuanView* pView = (CXiYuanView*)pFrame->GetActiveView();

	pView->Navigate2(_T("http://vod.cau.edu.cn/"), NULL, NULL);
	
	//CXiYuanView *pView = (CXiYuanView*)this->GetActiveView();
	////assert(pView);
	
	//LPDISPATCH *ppDisp=NULL ;
	//pView->SetRegisterAsBrowser(TRUE);
	//*ppDisp = pView->GetApplication();
	//BOOL cancel = false;
	//pView->OnNewWindow2(ppDisp,&cancel);
	//打开爱思主页新选项卡
	// Get a pointer to the application object.
	//CWinApp* pApp = AfxGetApp();
	//
	//// Get the correct document template.
	//POSITION pos = pApp->GetFirstDocTemplatePosition();
	//CDocTemplate* pDocTemplate = pApp->GetNextDocTemplate(pos);
	//// Create a new frame.
	//CFrameWnd* pFrame = pDocTemplate->CreateNewFrame(
	//	pDocTemplate->CreateNewDocument(),
	//	(CFrameWnd*)AfxGetMainWnd());
	//// Activate the frame.
	//pDocTemplate->InitialUpdateFrame(pFrame, NULL);
	//CXiYuanView* pView = (CXiYuanView*)pFrame->GetActiveView();
	//// Pass pointer of WebBrowser object.
	//pView->SetRegisterAsBrowser(TRUE);
	//LPDISPATCH ppDisp = pView->GetApplication();
	//
	////assert(ppDisp);
	//BOOL Cancel = TRUE;
	//pView->OnNewWindow2(&ppDisp,& Cancel);
	
	
}
Beispiel #5
0
void CMainFrame::OnButtonSport()
{
	// TODO:  在此添加命令处理程序代码
	CWinApp* pApp = AfxGetApp();

	// Get the correct document template.
	POSITION pos = pApp->GetFirstDocTemplatePosition();
	CDocTemplate* pDocTemplate = pApp->GetNextDocTemplate(pos);
	// Create a new frame.

	CFrameWnd* pFrame = pDocTemplate->CreateNewFrame(
		pDocTemplate->CreateNewDocument(),
		(CFrameWnd*)AfxGetMainWnd());
	// Activate the frame.
	pDocTemplate->InitialUpdateFrame(pFrame, NULL);
	CXiYuanView* pView = (CXiYuanView*)pFrame->GetActiveView();

	pView->Navigate2(_T("http://vod.cau.edu.cn/index.php?mod=category&action=view&id=106"), NULL, NULL);
}
Beispiel #6
0
void CMainFrame::OnButtonSearch()
{
	// TODO:  在此添加命令处理程序代码
	
	CString path;
	path=L"http://vod.cau.edu.cn/index.php?type=title&keyword="+m_search+L"&mod=content&action=search";
	// TODO:  在此添加命令处理程序代码
	CWinApp* pApp = AfxGetApp();
	// Get the correct document template.
	POSITION pos = pApp->GetFirstDocTemplatePosition();
	CDocTemplate* pDocTemplate = pApp->GetNextDocTemplate(pos);
	// Create a new frame.
	CFrameWnd* pFrame = pDocTemplate->CreateNewFrame(
		pDocTemplate->CreateNewDocument(),
		(CFrameWnd*)AfxGetMainWnd());
	// Activate the frame.
	pDocTemplate->InitialUpdateFrame(pFrame, NULL);
	CXiYuanView* pView = (CXiYuanView*)pFrame->GetActiveView();
	pView->Navigate2(path, NULL, NULL);


}
void CMainFrame::OnWindowNew() 
{
	CDocument *pDoc;

	pDoc = this->GetCurrentDoc ();
	if (pDoc != NULL)
	{
		CChildFrame* pActiveChild;
	
		pActiveChild =(CChildFrame *)this->MDIGetActive();
		// Create a new frame !
		CDocTemplate* pTemplate = pDoc->GetDocTemplate();
		ASSERT_VALID(pTemplate);

		CFrameWnd* pFrame = pTemplate->CreateNewFrame(pDoc, pActiveChild);
		if (pFrame == NULL)
		{
			TRACE0("Warning: failed to create new frame.\n");
			return;     // command failed
		}

		pTemplate->InitialUpdateFrame(pFrame, pDoc);
	}
}
Beispiel #8
0
void CMDIFrameWnd::OnWindowNew()
{
	CMDIChildWnd* pActiveChild = MDIGetActive();
	CDocument* pDocument;
	if (pActiveChild == NULL ||
	  (pDocument = pActiveChild->GetActiveDocument()) == NULL)
	{
		TRACE(traceAppMsg, 0, "Warning: No active document for WindowNew command.\n");
		AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
		return;     // command failed
	}

	// otherwise we have a new frame !
	CDocTemplate* pTemplate = pDocument->GetDocTemplate();
	ASSERT_VALID(pTemplate);
	CFrameWnd* pFrame = pTemplate->CreateNewFrame(pDocument, pActiveChild);
	if (pFrame == NULL)
	{
		TRACE(traceAppMsg, 0, "Warning: failed to create new frame.\n");
		return;     // command failed
	}

	pTemplate->InitialUpdateFrame(pFrame, pDocument);
}