-
Notifications
You must be signed in to change notification settings - Fork 0
/
MFCFrame.cpp
166 lines (136 loc) · 4.51 KB
/
MFCFrame.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// MFCFrame.cpp : implementation of the MFCFrame class
//
#include MfcPrecompileFile//#include "MFCpch.h"
#include "MFCFramework.h"
#include "MFCApp.h"
#include "MFCFrame.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// MFCFrame
#ifdef BlazesMFCApp_UseSDI
IMPLEMENT_DYNCREATE(MFCFrame, CFrameWnd)
#else
IMPLEMENT_DYNAMIC(MFCFrame, CMDIFrameWndEx)
#endif
#ifdef BlazesMFCApp_UseSDI
BEGIN_MESSAGE_MAP(MFCFrame, CFrameWnd)
#else
BEGIN_MESSAGE_MAP(MFCFrame, CMDIFrameWndEx)
#endif
ON_WM_CREATE()
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
// MFCFrame construction/destruction
MFCFrame::MFCFrame() noexcept
{
// TODO: add member initialization code here
}
MFCFrame::~MFCFrame()
{
}
int MFCFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
#ifdef BlazesMFCApp_UseSDI
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
#else
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
#endif
return -1;
#ifndef BlazesMFCApp_UseSDI
CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available...
mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area
mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI tabs
mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs
mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area
EnableMDITabbedGroups(TRUE, mdiTabParams);
#endif
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT) ||//Debug Assertation Failure here(MFC/bartool.cpp line 433)
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndDlgBar.Create(this, IDR_MAINFRAME, CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
{
TRACE0("Failed to create dialog bar\n");
return -1; // fail to create
}
if (!m_wndReBar.Create(this) || !m_wndReBar.AddBar(&m_wndToolBar) || !m_wndReBar.AddBar(&m_wndDlgBar))
{
TRACE0("Failed to create rebar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
#ifndef BlazesMFCApp_DisableTooltips
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
#endif
#ifndef BlazesMFCApp_UseSDI
// Switch the order of document name and application name on the window title bar. This
// improves the usability of the taskbar because the document name is visible with the thumbnail.
ModifyStyle(0, FWS_PREFIXTITLE);
#endif
return 0;
}
BOOL MFCFrame::PreCreateWindow(CREATESTRUCT& cs)
{
#ifdef BlazesMFCApp_UseSDI
if( !CFrameWnd::PreCreateWindow(cs) )
#else
if( !CMDIFrameWndEx::PreCreateWindow(cs) )
#endif
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
#ifdef BlazesMFCApp_EnableOutputWindow
BOOL MFCFrame::CreateOutputWindows()
{
BOOL bNameValid;
// Create output window
CString strOutputWnd;
bNameValid = strOutputWnd.LoadString(IDS_OUTPUT_WND);
ASSERT(bNameValid);
if (!m_wndOutput.Create(strOutputWnd, this, CRect(0, 0, 100, 100), TRUE, ID_VIEW_OUTPUTWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Output window\n");
return FALSE; // failed to create
}
HICON hOutputBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_OUTPUT_WND_HC), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndOutput.SetIcon(hOutputBarIcon, FALSE);
return TRUE;
}
#endif
// MFCFrame diagnostics
#ifdef _DEBUG
void MFCFrame::AssertValid() const
{
#ifdef BlazesMFCApp_UseSDI
CFrameWnd::AssertValid();
#else
CMDIFrameWndEx::AssertValid();
#endif
}
void MFCFrame::Dump(CDumpContext& dc) const
{
#ifdef BlazesMFCApp_UseSDI
CFrameWnd::Dump(dc);
#else
CMDIFrameWndEx::Dump(dc);
#endif
}
#endif //_DEBUG
// MFCFrame message handlers