【VC++开源代码栏目提醒】:网学会员--在 VC++开源代码编辑为广大网友搜集整理了:MFC计算器主要代码(C++) - 其它资料绩等信息,祝愿广大网友取得需要的信息,参考学习。
// Calculator_17483Dlg.cpp : implementation file//includequotstdafx.hquotincludequotCalculator_17483.hquotincludequotCalculator_17483Dlg.hquotincludequotafxdialogex.hquotifdef _DEBUGdefinenewDEBUG_NEWendif// CAboutDlg dialog used for App AboutclassCAboutDlg : publicCDialogExpublic: CAboutDlg// Dialog Data enum IDD IDD_ABOUTBOX protected: virtualvoidDoDataExchangeCDataExchange pDX //DDX/DDV support// Implementationprotected: DECLARE_MESSAGE_MAPCAboutDlg::CAboutDlg : CDialogExCAboutDlg::IDDvoidCAboutDlg::DoDataExchangeCDataExchange pDX CDialogEx::DoDataExchangepDXBEGIN_MESSAGE_MAPCAboutDlg CDialogExEND_MESSAGE_MAP// CCalculator_17483Dlg dialogCCalculator_17483Dlg::CCalculator_17483DlgCWndpParent/NULL/ : CDialogExCCalculator_17483Dlg::IDD pParent num10 num20 operation0 point0 nump_10 nump_20 m_hIcon AfxGetApp-gtLoadIconIDR_MAINFRAMEvoidCCalculator_17483Dlg::DoDataExchangeCDataExchange pDX CDialogEx::DoDataExchangepDXBEGIN_MESSAGE_MAPCCalculator_17483Dlg CDialogEx ON_WM_SYSCOMMAND ON_WM_PAINT ON_WM_QUERYDRAGICON ON_BN_CLICKEDIDC_BUTTON1ampCCalculator_17483Dlg::OnBnClickedButton1 ON_BN_CLICKEDIDC_BUTTON2ampCCalculator_17483Dlg::OnBnClickedButton2 ON_BN_CLICKEDIDC_BUTTON3ampCCalculator_17483Dlg::OnBnClickedButton3 ON_BN_CLICKEDIDC_BUTTON4ampCCalculator_17483Dlg::OnBnClickedButton4 ON_BN_CLICKEDIDC_BUTTON5ampCCalculator_17483Dlg::OnBnClickedButton5 ON_BN_CLICKEDIDC_BUTTON6ampCCalculator_17483Dlg::OnBnClickedButton6 ON_BN_CLICKEDIDC_BUTTON7ampCCalculator_17483Dlg::OnBnClickedButton7 ON_BN_CLICKEDIDC_BUTTON8ampCCalculator_17483Dlg::OnBnClickedButton8 ON_BN_CLICKEDIDC_BUTTON9ampCCalculator_17483Dlg::OnBnClickedButton9 ON_BN_CLICKEDIDC_BUTTON10ampCCalculator_17483Dlg::OnBnClickedButton10 ON_BN_CLICKEDIDC_BUTTON11ampCCalculator_17483Dlg::OnBnClickedButton11 ON_BN_CLICKEDIDC_BUTTON12ampCCalculator_17483Dlg::OnBnClickedButton12 ON_BN_CLICKEDIDC_BUTTON13ampCCalculator_17483Dlg::OnBnClickedButton13 ON_BN_CLICKEDIDC_BUTTON14ampCCalculator_17483Dlg::OnBnClickedButton14 ON_BN_CLICKEDIDC_BUTTON15ampCCalculator_17483Dlg::OnBnClickedButton15 ON_BN_CLICKEDIDC_BUTTON16ampCCalculator_17483Dlg::OnBnClickedButton16 ON_BN_CLICKEDIDC_BUTTON17ampCCalculator_17483Dlg::OnBnClickedButton17END_MESSAGE_MAP// CCalculator_17483Dlg message handlersBOOLCCalculator_17483Dlg::OnInitDialog CDialogEx::OnInitDialog // Add quotAbout...quot menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERTIDM_ABOUTBOXamp 0xFFF0 IDM_ABOUTBOX ASSERTIDM_ABOUTBOXlt 0xF000 CMenu pSysMenu GetSystemMenuFALSE if pSysMenu NULL BOOLbNameValid CStringstrAboutMenu bNameValid strAboutMenu.LoadStringIDS_ABOUTBOX ASSERTbNameValid if strAboutMenu.IsEmpty pSysMenu-gtAppendMenuMF_SEPARATOR pSysMenu-gtAppendMenuMF_STRING IDM_ABOUTBOXstrAboutMenu // Set the icon for this dialog. The framework does thisautomatically // when the applications main window is not a dialog SetIconm_hIcon TRUE // Set big icon SetIconm_hIcon FALSE // Set small icon // TODO: Add extra initialization here returnTRUE // return TRUE unless you set the focus to acontrolvoidCCalculator_17483Dlg::OnSysCommandUINTnIDLPARAMlParam if nIDamp 0xFFF0 IDM_ABOUTBOX CAboutDlgdlgAbout dlgAbout.DoModal else CDialogEx::OnSysCommandnID lParam // If you add a minimize button to your dialog you will need the codebelow// to draw the icon. For MFC applications using the document/viewmodel// this is automatically done for you by the framework.voidCCalculator_17483Dlg::OnPaint if IsIconic CPaintDCdcthis // device context for painting SendMessageWM_ICONERASEBKGNDreinterpret_castltWPARAMgtdc.GetSafeHdc 0 // Center icon in client rectangle intcxIcon GetSystemMetricsSM_CXICON intcyIcon GetSystemMetricsSM_CYICON CRectrect GetClientRecta