VC++计算器源文件Word文档下载推荐.docx
《VC++计算器源文件Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《VC++计算器源文件Word文档下载推荐.docx(17页珍藏版)》请在冰豆网上搜索。
#include"
stdafx.h"
mfccalc.h"
calcdlg.h"
#ifdef_DEBUG
#undefTHIS_FILE
staticcharBASED_CODETHIS_FILE[]=__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//CAboutDlgdialogusedforAppAbout
classCAboutDlg:
publicCDialog
{
public:
CAboutDlg();
//DialogData
//{{AFX_DATA(CAboutDlg)
enum{IDD=IDD_ABOUTBOX};
//}}AFX_DATA
//Implementation
protected:
virtualvoidDoDataExchange(CDataExchange*pDX);
//DDX/DDVsupport
//{{AFX_MSG(CAboutDlg)
virtualBOOLOnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg:
:
CAboutDlg():
CDialog(CAboutDlg:
IDD)
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
voidCAboutDlg:
DoDataExchange(CDataExchange*pDX)
CDialog:
DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//Nomessagehandlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//CAboutDlgmessagehandlers
BOOLCAboutDlg:
OnInitDialog()
OnInitDialog();
//TODO:
Addextrainitializationhere
returnTRUE;
//CCalcDlgdialog
IMPLEMENT_DYNCREATE(CCalcDlg,CDialog)
BEGIN_DISPATCH_MAP(CCalcDlg,CDialog)
//{{AFX_DISPATCH_MAP(CCalcDlg)
DISP_PROPERTY_EX(CCalcDlg,"
Accum"
GetAccum,SetAccum,VT_I4)
Operand"
GetOperand,SetOperand,VT_I4)
Operation"
GetOperation,SetOperation,VT_I2)
Visible"
GetVisible,SetVisible,VT_BOOL)
DISP_FUNCTION(CCalcDlg,"
Evaluate"
Evaluate,VT_BOOL,VTS_NONE)
Clear"
Clear,VT_EMPTY,VTS_NONE)
Display"
Display,VT_EMPTY,VTS_NONE)
Close"
Close,VT_EMPTY,VTS_NONE)
Button"
Button,VT_BOOL,VTS_BSTR)
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
#ifndefIMPLEMENT_OLECREATE_SINGLE
//MFCwillprovidethismacrointhefuture.
Fornow,wedefineit.
#defineIMPLEMENT_OLECREATE_SINGLE(class_name,external_name,\
l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)\
AFX_DATADEFCOleObjectFactoryclass_name:
factory(class_name:
guid,\
RUNTIME_CLASS(class_name),TRUE,_T(external_name));
\
constAFX_DATADEFGUIDclass_name:
guid=\
{l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}};
//{62C4DD10-F45E-11cd-8C3D-00AA004BB3B7}
IMPLEMENT_OLECREATE_SINGLE(CCalcDlg,"
mfccalc.calculator"
0x62c4dd10,0xf45e,0x11cd,0x8c,0x3d,0x0,0xaa,0x0,0x4b,0xb3,0xb7);
CCalcDlg:
CCalcDlg(CWnd*pParent/*=NULL*/)
:
CDialog(CCalcDlg:
IDD,pParent)
m_bAutoDelete=TRUE;
//defaulttoauto-delete
m_dwRegister=0;
//notregisteredasactivebydefault
//{{AFX_DATA_INIT(CCalcDlg)
//NOTE:
theClassWizardwilladdmemberinitializationhere
//NotethatLoadIcondoesnotrequireasubsequentDestroyIconinWin32
m_hIcon=AfxGetApp()->
LoadIcon(IDR_MAINFRAME);
//NotethatLoadAcceleratordoesnotrequireDestroyAcceleratorTable
m_hAccel=LoadAccelerators(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDD));
//clearthecontentsofthecalculatorandresetstate
OnClickedClear();
//enablethisobjectforOLEautomation
EnableAutomation();
~CCalcDlg()
if(m_dwRegister!
=0)
RevokeActiveObject(m_dwRegister,NULL);
voidCCalcDlg:
//{{AFX_DATA_MAP(CCalcDlg)
theClassWizardwilladdDDXandDDVcallshere
//CCalcDlgimpl