资源简介
简单的单文档程序,实现了分割窗口和树形目录的创建,便于想了解树形目录如何创建的朋友参考。
代码片段和文件信息
// MainFrm.cpp : implementation of the CMainframe class
//
#include “stdafx.h“
#include “TreeNavi.h“
#include “TreeView.h“
#include “TreeNaviView.h“
#include “MainFrm.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainframe
IMPLEMENT_DYNCREATE(CMainframe CframeWnd)
BEGIN_MESSAGE_MAP(CMainframe CframeWnd)
//{{AFX_MSG_MAP(CMainframe)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR // status line indicator
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};
/////////////////////////////////////////////////////////////////////////////
// CMainframe construction/destruction
CMainframe::CMainframe()
{
// TODO: add member initialization code here
}
CMainframe::~CMainframe()
{
}
int CMainframe::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CframeWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this TBstyle_FLAT WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINframe))
{
TRACE0(“Failed to create toolbar\n“);
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators
sizeof(indicators)/sizeof(UINT)))
{
TRACE0(“Failed to create status bar\n“);
return -1; // fail to create
}
// TODO: Delete these three lines if you don‘t want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainframe::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CframeWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainframe diagnostics
#ifdef _DEBUG
void CMainframe::AssertValid() const
{
CframeWnd::AssertValid();
}
void CMainframe::Dump(CDumpContext& dc) const
{
CframeWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainframe message handlers
BOOL CMainframe::OnCreateClient(LPCREATESTRUCT lpcs CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
// CSplitterWnd split;
split.CreateStatic(this13); //创建分割窗体
split.CreateView(00RUNTIME_CLASS(TreeView)CSize(200100)pContext); //创建左侧子视图
split.CreateView(01RUNTIME_CLASS(CTreeNaviView)CSize(400100)pContext); //创建右侧子视图
split.CreateView(02RUNTIME_CLASS(CTreeNaviVie
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-06-08 11:45 TreeNavi\
目录 0 2011-06-08 11:10 TreeNavi\Debug\
文件 21935 2011-06-08 11:10 TreeNavi\Debug\MainFrm.obj
文件 0 2011-06-08 11:10 TreeNavi\Debug\MainFrm.sbr
文件 105677 2011-06-08 11:10 TreeNavi\Debug\StdAfx.obj
文件 1376938 2011-06-08 11:10 TreeNavi\Debug\StdAfx.sbr
文件 3146752 2011-06-08 11:10 TreeNavi\Debug\TreeNavi.bsc
文件 122954 2011-06-08 11:10 TreeNavi\Debug\TreeNavi.exe
文件 349444 2011-06-08 11:10 TreeNavi\Debug\TreeNavi.ilk
文件 22926 2011-06-08 11:10 TreeNavi\Debug\TreeNavi.obj
文件 6953136 2011-06-08 11:10 TreeNavi\Debug\TreeNavi.pch
文件 467968 2011-06-08 11:10 TreeNavi\Debug\TreeNavi.pdb
文件 8144 2011-06-05 15:14 TreeNavi\Debug\TreeNavi.res
文件 0 2011-06-08 11:10 TreeNavi\Debug\TreeNavi.sbr
文件 14884 2011-06-08 11:10 TreeNavi\Debug\TreeNaviDoc.obj
文件 0 2011-06-08 11:10 TreeNavi\Debug\TreeNaviDoc.sbr
文件 22146 2011-06-08 11:10 TreeNavi\Debug\TreeNaviView.obj
文件 0 2011-06-08 11:10 TreeNavi\Debug\TreeNaviView.sbr
文件 25010 2011-06-08 11:10 TreeNavi\Debug\TreeView.obj
文件 0 2011-06-08 11:10 TreeNavi\Debug\TreeView.sbr
文件 214016 2011-06-08 11:10 TreeNavi\Debug\vc60.idb
文件 364544 2011-06-08 11:10 TreeNavi\Debug\vc60.pdb
文件 3124 2011-05-04 20:43 TreeNavi\MainFrm.cpp
文件 1704 2011-05-04 20:02 TreeNavi\MainFrm.h
文件 4359 2011-04-27 21:59 TreeNavi\ReadMe.txt
目录 0 2011-05-20 07:44 TreeNavi\res\
文件 640 2011-04-28 10:52 TreeNavi\resource.h
文件 766 2011-04-27 22:53 TreeNavi\res\icon1.ico
文件 1078 2011-04-27 21:59 TreeNavi\res\Toolbar.bmp
文件 1078 2011-04-27 21:59 TreeNavi\res\TreeNavi.ico
文件 400 2011-04-27 21:59 TreeNavi\res\TreeNavi.rc2
............此处省略19个文件信息
- 上一篇:基于VC++6.0的UDP通讯
- 下一篇:MFC C++英汉词典
评论
共有 条评论