Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
PppView.cpp
Package: TreeCtrlDB.rar [view]
Upload User: kjzhanglin
Upload Date: 2021-07-11
Package Size: 31k
Code Size: 4k
Category:
TreeView
Development Platform:
Visual C++
- // PppView.cpp : implementation of the CPppView class
- // Download by http://www.codefans.net
- #include "stdafx.h"
- #include "Ppp.h"
- #include "PppDoc.h"
- #include "PppView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CPppView
- IMPLEMENT_DYNCREATE(CPppView, CFormView)
- BEGIN_MESSAGE_MAP(CPppView, CFormView)
- //{{AFX_MSG_MAP(CPppView)
- ON_NOTIFY(TVN_SELCHANGING, IDC_TREE1, OnSelchangingTree1)
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CPppView construction/destruction
- CPppView::CPppView()
- : CFormView(CPppView::IDD)
- {
- //{{AFX_DATA_INIT(CPppView)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- // TODO: add construction code here
- }
- CPppView::~CPppView()
- {
- }
- void CPppView::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPppView)
- DDX_Control(pDX, IDC_TREE1, m_treectrl);
- //}}AFX_DATA_MAP
- }
- BOOL CPppView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CFormView::PreCreateWindow(cs);
- }
- void CPppView::OnInitialUpdate()
- {
- CFormView::OnInitialUpdate();
- //GetParentFrame()->RecalcLayout();
- //ResizeParentToFit();
- CPppDoc* pDoc = (CPppDoc*)GetDocument();
- m_ShengSet=&pDoc->m_ShengSet;
- TV_INSERTSTRUCT tvinsert;
- tvinsert.hParent = NULL;
- tvinsert.item.mask = TVIF_TEXT;
- tvinsert.item.pszText = "全国";
- HTREEITEM hDad = m_treectrl.InsertItem(&tvinsert);
- if (m_ShengSet->IsOpen())
- m_ShengSet->Close();
- m_ShengSet->Open();
- m_ShengSet->MoveFirst();
- CString c1;
- char buff[80];
- while(!m_ShengSet->IsEOF())
- {
- c1=m_ShengSet->m_column1;
- wsprintf(buff,"%s",c1);
- tvinsert.item.pszText = buff;
- tvinsert.hParent = hDad;
- m_treectrl.InsertItem(&tvinsert);
- m_ShengSet->MoveNext();
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPppView printing
- BOOL CPppView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CPppView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CPppView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- void CPppView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
- {
- // TODO: add customized printing code here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPppView diagnostics
- #ifdef _DEBUG
- void CPppView::AssertValid() const
- {
- CFormView::AssertValid();
- }
- void CPppView::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
- CPppDoc* CPppView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPppDoc)));
- return (CPppDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CPppView message handlers
- void CPppView::OnSelchangingTree1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
- // TODO: Add your control notification handler code here
- CTreeCtrl* pTree2 = (CTreeCtrl*) GetDlgItem(IDC_TREE1);
- HTREEITEM hSelected = pNMTreeView->itemNew.hItem;
- CPppDoc* pDoc = (CPppDoc*)GetDocument();
- CString hParentName;
- HTREEITEM hParent=pTree2->GetParentItem(hSelected);
- if(hSelected!=NULL)
- {
- pDoc->Name=pTree2->GetItemText(hSelected);
- }
- *pResult = 0;
- }