?? mainfrm.cpp
字號:
// MainFrm.cpp : CMainFrame 類的實現
//
#include "stdafx.h"
#include "ST3901070422.h"
#include "MainFrm.h"
#include "ST3901070422Doc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
ON_COMMAND(ID_VIWE_FUND, &CMainFrame::OnViweFund)
ON_UPDATE_COMMAND_UI(ID_VIWE_FUND, &CMainFrame::OnUpdateViweFund)
ON_WM_ACTIVATEAPP()
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // 狀態行指示器
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
// CMainFrame 構造/析構
CMainFrame::CMainFrame():m_bFundsVisible(false)
{
// TODO: 在此添加成員初始化代碼
}
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("未能創建工具欄\n");
return -1; // 未能創建
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("未能創建狀態欄\n");
return -1; // 未能創建
}
// TODO: 如果不需要工具欄可??浚瑒t刪除這三行
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
m_wndFundDialog.Create(IDD_FUNDDIALOG);
m_wndFundDialog.SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: 在此處通過修改
// CREATESTRUCT cs 來修改窗口類或樣式
return TRUE;
}
// CMainFrame 診斷
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
// CMainFrame 消息處理程序
void CMainFrame::OnViweFund()
{
// TODO: 在此添加命令處理程序代碼
SetFundsVisible(m_bFundsVisible?false:true);
}
void CMainFrame::OnUpdateViweFund(CCmdUI *pCmdUI)
{
// TODO: 在此添加命令更新用戶界面處理程序代碼
bool bEnable=false;
CST3901070422Doc* pDoc = dynamic_cast<CST3901070422Doc*>(GetActiveDocument());
if(pDoc)
{
bEnable= pDoc->GetDocList().GetCount()?true:false;
}
pCmdUI->Enable(bEnable);
if(bEnable)
{
pCmdUI->SetCheck(m_bFundsVisible?1:0);
}
}
void CMainFrame::UpdateFundList(const CStockDataList& pList,CString strCurrentFund)
{
CListBox *pListBox = &m_wndFundDialog.m_listBox;
pListBox->ResetContent();
CString strLastFund;
POSITION pos = pList.GetHeadPosition();
while( pos )
{
CStockData sd = pList.GetNext( pos );
CString strFund = sd.GetFund();
if( strFund != strLastFund )
pListBox->AddString( strFund );
strLastFund = strFund;
}
int iPos = pListBox->FindStringExact( -1, strCurrentFund );
pListBox->SetCurSel( iPos );
}
void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID)
{
CFrameWnd::OnActivateApp(bActive, dwThreadID);
// TODO: 在此處添加消息處理程序代碼
if( bActive )
{
if( AreFundsVisible())
m_wndFundDialog.ShowWindow( SW_SHOW );
}
else
{
if( AreFundsVisible())
m_wndFundDialog.ShowWindow( SW_HIDE );
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -