Monitor.cpp
资源名称:ictprop.rar [点击查看]
上传用户:tenhai
上传日期:2021-02-19
资源大小:492k
文件大小:3k
源码类别:
组合框控件
开发平台:
Visual C++
- // Monitor.cpp: implementation of the CMonitor class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "propDoc.h"
- #include "propview.h"
- #include "slstDoc.h"
- #include "slstView.h"
- #include "ptreeDoc.h"
- #include "ptreeView.h"
- #include "prop.h"
- #include "Monitor.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CMonitor::CMonitor()
- {
- }
- CMonitor::~CMonitor()
- {
- }
- void CMonitor::display(CString str)
- {
- extern CPropApp theApp;
- POSITION propDocPos=theApp.m_pDocTemplate->GetFirstDocPosition();
- if (!propDocPos)
- return;
- CPropDoc *pDoc=(CPropDoc *)theApp.m_pDocTemplate->GetNextDoc(propDocPos);
- POSITION propViewPos=pDoc->GetFirstViewPosition();
- if (!propViewPos)
- return;
- CPropView *pView = (CPropView *) pDoc->GetNextView(propViewPos);
- /*
- CMDIFrameWnd *pFrame =
- (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
- // Get the active MDI child window.
- CMDIChildWnd *pChild =
- (CMDIChildWnd *) pFrame->GetActiveFrame();
- // or CMDIChildWnd *pChild = pFrame->MDIGetActive();
- // Get the active view attached to the active MDI child
- // window.
- CPropView *pView = (CPropView *) pChild->GetActiveView();
- */
- CRichEditCtrl &pREC= pView->GetRichEditCtrl();
- pREC.ReplaceSel((LPCTSTR) str, FALSE);
- pView->UpdateWindow();
- }
- CMonitor theMonitor;
- void CMonitor::list(CString str)
- {
- extern CPropApp theApp;
- POSITION slstDocPos=theApp.m_sDocTemplate->GetFirstDocPosition();
- if (!slstDocPos)
- return;
- CSlstDoc *pDoc=(CSlstDoc *)theApp.m_sDocTemplate->GetNextDoc(slstDocPos);
- POSITION slstViewPos=pDoc->GetFirstViewPosition();
- if (!slstViewPos)
- return;
- CSlstView *pView = (CSlstView *)pDoc->GetNextView(slstViewPos);
- // Gain a reference to the list control itself
- CTreeCtrl& pLSC = pView->GetTreeCtrl();
- TVINSERTSTRUCT tvInsert;
- tvInsert.hParent = NULL;
- tvInsert.hInsertAfter = NULL;
- tvInsert.item.mask = TVIF_TEXT;
- tvInsert.item.pszText=str.GetBuffer(1);
- pLSC.InsertItem(&tvInsert);
- pView->UpdateWindow();
- }
- void CMonitor::show(int id, CString str)
- {
- extern CPropApp theApp;
- POSITION ptreeDocPos=theApp.m_qDocTemplate->GetFirstDocPosition();
- if (!ptreeDocPos)
- return;
- CPtreeDoc *pDoc=(CPtreeDoc *)theApp.m_qDocTemplate->GetNextDoc(ptreeDocPos);
- POSITION ptreeViewPos=pDoc->GetFirstViewPosition();
- if (!ptreeViewPos)
- return;
- CPtreeView *pView = (CPtreeView *)pDoc->GetNextView(ptreeViewPos);
- pView->UpdateTree(id, str);
- }