void CMainFrame::OnViewDeletedrecords() { m_bShowDeletedRecords = !m_bShowDeletedRecords; CWinApp* pApp = AfxGetApp(); ASSERT_VALID(pApp); // Iterate through the application's document templates list POSITION posTemplate = pApp->GetFirstDocTemplatePosition(); while(posTemplate) { // For each document template object... CDocTemplate* pTemplate = pApp->GetNextDocTemplate(posTemplate); ASSERT_VALID(pTemplate); ASSERT_KINDOF(CDocTemplate, pTemplate); // Iterate through the template's document list POSITION posDocument = pTemplate->GetFirstDocPosition(); while(posDocument) { // For each document object... CDocument* pDoc = pTemplate->GetNextDoc(posDocument); ASSERT_VALID(pDoc); ASSERT_KINDOF(CDocument, pDoc); // reload records POSITION pos = pDoc->GetFirstViewPosition(); while (pos) ((CDBFExplorerView *)pDoc->GetNextView(pos))->ShowRecords(m_bShowDeletedRecords); } } }
// 在 Frame中发消息给View U32 CPluginApp_i::SendMessageToView(UINT ulMsg, WPARAM wParam, LPARAM lParam) { CWinApp* pWinApp = AfxGetApp(); if(pWinApp) { POSITION DocTemplatePos = pWinApp->GetFirstDocTemplatePosition(); //while(DocTemplatePos) { CMultiDocTemplate* pDocTemp = (CMultiDocTemplate*)pWinApp->GetNextDocTemplate(DocTemplatePos); // POSITION pos = pDocTemp->GetFirstDocPosition (); // Find the doc within the same doctemplate. while (pos) { CDocument* pDoc = pDocTemp->GetNextDoc (pos); POSITION ViewPos = pDoc->GetFirstViewPosition (); CView* pView = pDoc->GetNextView (ViewPos); if(pView) { CMDIChildWnd* pFrame = (CMDIChildWnd*)pView->GetParentFrame(); if(pFrame == this) { //OutputDebugString("Find!\n"); pView->SendMessage(ulMsg, wParam, lParam); } } } } } return 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); }
void Daten::update_display() { CWinApp *a; CDocTemplate *t; CDocument *d; CView *v; POSITION p; a = AfxGetApp(); p = a->GetFirstDocTemplatePosition(); t = a->GetNextDocTemplate( p); p = t->GetFirstDocPosition(); d = t->GetNextDoc( p); p = d->GetFirstViewPosition(); v = d->GetNextView( p); v->RedrawWindow(); }
CBioSIMDoc* CResultDataWnd::GetDocument() { CDocument* pDoc = NULL; CWinApp* pApp = AfxGetApp(); if (pApp) { POSITION pos = pApp->GetFirstDocTemplatePosition(); CDocTemplate* docT = pApp->GetNextDocTemplate(pos); if (docT) { pos = docT->GetFirstDocPosition(); pDoc = docT->GetNextDoc(pos); } } return static_cast<CBioSIMDoc*>(pDoc); }
CWeatherUpdaterDoc* CTaskPropertyWnd::GetDocument() { CWeatherUpdaterDoc* pDoc = NULL; CWinApp* pApp = AfxGetApp(); if (pApp) { POSITION pos = pApp->GetFirstDocTemplatePosition(); CDocTemplate* docT = pApp->GetNextDocTemplate(pos); if (docT) { pos = docT->GetFirstDocPosition(); pDoc = (CWeatherUpdaterDoc*)docT->GetNextDoc(pos); } } return pDoc; }
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); }
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); }