Home >
Back-end > MFC design computer for help, this program where wrong?? Help me to change
MFC design computer for help, this program where wrong?? Help me to change
//jsqDlg. CPP: implementation file//# include "stdafx. H" # include "JSQ. H" # include "jsqDlg. H # ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILEstatic char THIS_FILE []=__FILE__; # endif///////////////////////////////////////////////////////////////////////////////CAboutDlg dialog informs the for App Aboutclass CAboutDlg: public CDialog {public: CAboutDlg ();//Dialog Data//{{AFX_DATA (CAboutDlg) enum {IDD=IDD_ABOUTBOX};//}} AFX_DATA//ClassWizard generated virtual function overrides//{{AFX_VIRTUAL (CAboutDlg) protected: virtual void DoDataExchange (CDataExchange * symbol;//(DDX/DDV support AFX_VIRTUAL////}} Implementationprotected://{{AFX_MSG (CAboutDlg)//}} AFX_MSG DECLARE_MESSAGE_MAP ()}; CAboutDlg: : CAboutDlg () : CDialog CAboutDlg: : (IDD) {//{{AFX_DATA_INIT (CAboutDlg)//}} AFX_DATA_INIT} void CAboutDlg: : DoDataExchange (CDataExchange * symbol {CDialog: : DoDataExchange (symbol);//{{AFX_DATA_MAP (CAboutDlg)//}} AFX_DATA_MAP} BEGIN_MESSAGE_MAP (CAboutDlg CDialog)//{{AFX_MSG_MAP (CAboutDlg)//No message handlers//}} AFX_MSG_MAPEND_MESSAGE_MAP ()///////////////////////////////////////////////////////////////////////////////CJsqDlg dialogCJsqDlg: : CJsqDlg (=NULL CWnd * pParent/* */) : CDialog (CJsqDlg: : IDD, pParent) {m_display=0.0; Num1=0; Num2=0; Result=0.0; STR=""; Str_flag=FALSE; Continue_flg=FALSE; DownDot=FALSE; Count=1;//{{AFX_DATA_INIT (CJsqDlg)//NOTE: the ClassWizard will add member initialization here//}} AFX_DATA_INIT//NOTE that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon=AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME); } void CJsqDlg: : DoDataExchange (CDataExchange * symbol {CDialog: : DoDataExchange (symbol);//{{AFX_DATA_MAP(CJsqDlg)//NOTE: the ClassWizard will add DDX and DDV calls here//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CJsqDlg, CDialog)//{{AFX_MSG_MAP(CJsqDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON_7, OnButton7) ON_BN_CLICKED(IDC_BUTTON_8, OnButton8) ON_BN_CLICKED(IDC_BUTTON_9, OnButton9) ON_BN_CLICKED(IDC_BUTTON_4, OnButton4) ON_BN_CLICKED(IDC_BUTTON_5, OnButton5) ON_BN_CLICKED(IDC_BUTTON_6, OnButton6) ON_BN_CLICKED(IDC_BUTTON_1, OnButton1) ON_BN_CLICKED(IDC_BUTTON_2, OnButton2) ON_BN_CLICKED(IDC_BUTTON_3, OnButton3) ON_BN_CLICKED(IDC_BUTTON_0, OnButton0) ON_BN_CLICKED(IDC_BUTTON_add, OnBUTTONadd) ON_BN_CLICKED(IDC_BUTTON_sub, OnBUTTONsub) ON_BN_CLICKED(IDC_BUTTON_mult, OnBUTTONmult) ON_BN_CLICKED(IDC_BUTTON_div, OnBUTTONdiv) ON_BN_CLICKED(IDC_BUTTON_equal, OnBUTTONequal) ON_BN_CLICKED(IDC_BUTTON_dian, OnBUTTONdian) ON_BN_CLICKED(IDC_BUTTON_c, OnBUTTONc)//}}AFX_MSG_MAPEND_MESSAGE_MAP()///////////////////////////////////////////////////////////////////////////////CJsqDlg message handlersBOOL CJsqDlg::OnInitDialog(){ CDialog::OnInitDialog();//Add "About... "Menu item to system menu.//IDM_ABOUTBOX must be in the system command range. The ASSERT ((IDM_ABOUTBOX & amp; 0==IDM_ABOUTBOX xfff0)); ASSERT (IDM_ABOUTBOX & lt; 0 xf000); CMenu * pSysMenu=GetSystemMenu (FALSE); If (pSysMenu!=NULL) {cstrings strAboutMenu; StrAboutMenu. LoadString (IDS_ABOUTBOX); if (! StrAboutMenu. IsEmpty ()) {pSysMenu - & gt; The AppendMenu (MF_SEPARATOR); PSysMenu - & gt; AppendMenu (MF_STRING IDM_ABOUTBOX, strAboutMenu); }}//Set the icon for this dialog. The framework does this automatically//when the application 's main window is not a dialog SetIcon (m_hIcon, TRUE);//Set the big icon SetIcon (m_hIcon, FALSE);//Set the small icon//TODO: Add extra initialization here return TRUE;//return TRUE unless you set the focus to a control} void CJsqDlg: : OnSysCommand (UINT nID, LPARAM LPARAM) {if ((nID & amp; 0 xfff0)==IDM_ABOUTBOX) {CAboutDlg dlgAbout; DlgAbout. DoModal (); } else {CDialog: : OnSysCommand (nID, lParam); }}//If you add a minimize button to your dialog, you will need the code below//to draw the icon. The For MFC applications using the document/view model,//this is automatically done For you by the framework. The void CJsqDlg: : OnPaint () {If (IsIconic ()) {CPaintDC dc (this);//device context for painting SendMessage (WM_ICONERASEBKGND, (WPARAM) dc. GetSafeHdc (), 0).//Center icon in the client rectangle int cxIcon=GetSystemMetrics (SM_CXICON); Int cyIcon=GetSystemMetrics (SM_CYICON); CRect the rect. GetClientRect (& amp; The rect); Int x=(the rect. Width () - cxIcon + 1)/2; Int y=(the rect. Height () - cyIcon + 1)/2;//Draw the icon. Dc DrawIcon (x, y, m_hIcon); } else {CDialog: : OnPaint (); }}//The system calls this to obtain The cursor to display while The user drags//The minimized window. The HCURSOR CJsqDlg: : OnQueryDragIcon () {return (HCURSOR) m_hIcon; } double CCounterDlg: : buttonDownNum (int numSize) {if (! Str_flag)//operators were not press, that is num1 {the if (! Continue_flg)//in the next {num1=numSize; Continue_flg=TRUE; } else {num1=(10, count) + numSize num1 * pow; If (downDot) {num1=num1/(10, count) (pow); count++; }} return num1; } the else//operators have been pressing {if (! Whether continue_flg)//continuous press {num2=numSize; Continue_flg=TRUE; } else {num2=(10, count) + num2 * pow numSize; If (downDot) {num2=num2/(10, count) (pow); count++; }} return num2; nullnullnullnullnullnull