Program: Class Name: CDLG - CPP Project Name: Statusbar in Mainfrm.H
Program: Class Name: CDLG - CPP Project Name: Statusbar in Mainfrm.H
Program: Class Name: CDLG - CPP Project Name: Statusbar in Mainfrm.H
In MainFrm.h
#if !
defined(AFX_MAINFRM_H__36FB7EA7_3622_404C_88A1_A4AE22EBB7C5__INCLU
DED_)
#define
AFX_MAINFRM_H__36FB7EA7_3622_404C_88A1_A4AE22EBB7C5__INCLUDED_
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the
previous line.
#endif // !
defined(AFX_MAINFRM_H__36FB7EA7_3622_404C_88A1_A4AE22EBB7C5__INCLU
DED_)
In MainFrm.cpp
#include "stdafx.h"
#include "StatusBar.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)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_LEFT,OnUpdateLeft)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_RIGHT,OnUpdateRight)
//{{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()
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
CMainFrame::~CMainFrame()
{
}
if (!m_wndStatusBar.Create(this,WS_CHILD|WS_VISIBLE|
CBRS_BOTTOM,ID_MY_STATUS_BAR) ||
!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;
}
return TRUE;
}
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
#endif //_DEBUG
In View.cpp
#include "stdafx.h"
#include "StatusBar.h"
#include "StatusBarDoc.h"
#include "StatusBarView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// CStatusBarView
IMPLEMENT_DYNCREATE(CStatusBarView, CView)
BEGIN_MESSAGE_MAP(CStatusBarView, CView)
//{{AFX_MSG_MAP(CStatusBarView)
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
// CStatusBarView construction/destruction
CStatusBarView::CStatusBarView()
{
}
CStatusBarView::~CStatusBarView()
{
}
// CStatusBarView drawing
// CStatusBarView printing
#ifdef _DEBUG
void CStatusBarView::AssertValid() const
{
CView::AssertValid();
}
RESULT: