📄 mainfrm.cpp
字号:
// mainfrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "modem16.h"
#include "modem.h"
#include "zstabar.h"
#include "mainfrm.h"
#include "modemdoc.h"
#include "modemvw.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
static UINT BASED_CODE indicators[] =
{
ID_SEPARATOR, // status line indicator
IDS_INDICATOR
};
static UINT BASED_CODE IDs[]=
{
ID_PHONE_DIAL,
ID_T_RECEIVEFILE,
ID_T_SENDFILE,
ID_SEPARATOR,
ID_SETUP,
ID_SEPARATOR,
ID_SEPARATOR
};
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
// a *b=new a();
}
CMainFrame::~CMainFrame()
{
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// UINT nID,nStyle;
// int cxWidth;
// CRect rect;
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE("Failed to create status bar\n");
return -1; // fail to create
}
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadBitmap(IDB_BITMAP1)||
!m_wndToolBar.SetButtons(IDs,7))
{
TRACE("Failed to create toolbar\n");
return -1; // fail to create
}
CSize buttonsize(44,42);
CSize imagesize(38,36);
m_wndToolBar.SetSizes(buttonsize,imagesize);
// m_wndStatusBar.GetPaneInfo( 0, nID, nStyle, cxWidth);
// m_wndStatusBar.SetPaneInfo( 0, nID, SBPS_STRETCH|SBPS_NORMAL, cxWidth);
m_wndToolBar.SetButtonInfo(6, IDW_COMBO, TBBS_SEPARATOR, 100 );
// Design guide advises 12 pixel gap between combos and buttons
m_wndToolBar.SetButtonInfo(5, ID_SEPARATOR, TBBS_SEPARATOR, 12 );
CRect rect;
m_wndToolBar.GetItemRect( 6, &rect);
rect.top =10;
rect.bottom = rect.top + 100;
if (!m_wndToolBar.m_comboBox.Create(CBS_DROPDOWNLIST|WS_VSCROLL|
WS_VISIBLE|WS_TABSTOP,rect, &m_wndToolBar, IDW_COMBO))
{
TRACE("Failed to create combo-box\n");
return FALSE;
}
// Fill the combo box
m_wndToolBar.m_comboBox.AddString("600");
m_wndToolBar.m_comboBox.AddString("1200");
m_wndToolBar.m_comboBox.AddString("2400");
m_wndToolBar.m_comboBox.AddString("4800");
m_wndToolBar.m_comboBox.AddString("9600");
m_wndToolBar.m_comboBox.AddString("14400");
m_wndToolBar.m_comboBox.AddString("19200");
m_wndToolBar.m_comboBox.SelectString(-1,
AfxGetApp()->GetProfileString("COM","Baud","2400"));
// Create a font for the combobox
// LOGFONT logFont;
// memset(&logFont, 0, sizeof(logFont));
// Since design guide says toolbars are fixed height so is the font.
// logFont.lfHeight = -13;
// logFont.lfWeight = FW_NORMAL;
// logFont.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
// lstrcpy(logFont.lfFaceName, "MS Sans Serif");
// if (!m_wndToolBar.m_font.CreateFontIndirect(&logFont))
// TRACE("Could Not create font for combo\n");
// else
// m_wndToolBar.m_comboBox.SetFont(&m_wndToolBar.m_font);
return 0;
}
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
/* CModem16View *ModemView;
ModemView=(CModem16View *)GetActiveView();
ModemView->Modem.Stop();*/
GetActiveDocument()->SetModifiedFlag(FALSE);
CFrameWnd::OnClose();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -