?? mainfrm.cpp
字號:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "OpcClientSpy.h"
#include "MainFrm.h"
#include "InfoFormView.h"
#include "TopSplitView.h"
#include "NetInfoDaDlg.h"
#include "DxPropDlg.h"
#include "AlarmEventDlg.h"
#include "ValueMsgView.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)
ON_WM_CREATE()
ON_COMMAND(IDT_COMPUTER_LIST, OnComputerList)
//}}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) ||
!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 dialogbar\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) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY);
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// 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)
{
//return CFrameWnd::OnCreateClient(lpcs, pContext);
if (!m_wndSplitter.CreateStatic(this, 2, 1))
{
TRACE0("無法切分窗口\n");
return FALSE;
}
CRect rect;
GetClientRect(&rect);
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTopSplitView), CSize(0, rect.Height()/3*2), pContext))
{
TRACE0("無法創建CTopSplitView\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CInfoFormView), CSize(0,0), pContext))
{
TRACE0("無法創建CInfoFormView\n");
return FALSE;
}
// Set the left pane as the active view
CTopSplitView *pView = (CTopSplitView*)m_wndSplitter.GetPane(0, 0);
CServerInfoView *m_pServerInfoView = (CServerInfoView *)pView->m_leftRightSplitter.GetPane(0,0);
SetActiveView(m_pServerInfoView);
CValueMsgView *pValue = (CValueMsgView *)pView->m_leftRightSplitter.GetPane(0,1);
pValue->m_pServerView = m_pServerInfoView;
return TRUE;
}
//顯示網絡中資源情況
void CMainFrame::OnComputerList()
{
CPropertySheet info("網絡中所有計算機");
CNetInfoDaDlg netDa;
info.AddPage(&netDa);
CAlarmEventDlg alarmEvent;
info.AddPage(&alarmEvent);
CDxPropDlg dxDlg;
info.AddPage(&dxDlg);
info.DoModal();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -