AddHistoryDlg.cpp
上传用户:flyanjing
上传日期:2015-10-09
资源大小:649k
文件大小:2k
- // AddHistoryDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ShuangSeQiu.h"
- #include "AddHistoryDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CAddHistoryDlg dialog
- CAddHistoryDlg::CAddHistoryDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CAddHistoryDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CAddHistoryDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CAddHistoryDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAddHistoryDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CAddHistoryDlg, CDialog)
- //{{AFX_MSG_MAP(CAddHistoryDlg)
- ON_BN_CLICKED(IDC_BTN_ADD, OnBtnAdd)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CAddHistoryDlg message handlers
- void CAddHistoryDlg::OnBtnAdd()
- {
- CString str;
- CString sn,r1,r2,r3,r4,r5,r6,b;
- CString r[6];
- GetDlgItemText(IDC_EDIT_SN,sn);
- GetDlgItemText(IDC_EDIT_R1,r[0]);
- GetDlgItemText(IDC_EDIT_R2,r[1]);
- GetDlgItemText(IDC_EDIT_R3,r[2]);
- GetDlgItemText(IDC_EDIT_R4,r[3]);
- GetDlgItemText(IDC_EDIT_R5,r[4]);
- GetDlgItemText(IDC_EDIT_R6,r[5]);
- GetDlgItemText(IDC_EDIT_B,b);
- str = str+ sn + ":";
- for(int i=0;i<6;i++){
- str = str+ r[i]+ ",";
- }
- str = str + b;
- CStdioFile file;
- file.Open("history.txt",CFile::modeReadWrite);
- file.SeekToEnd();
- file.WriteString("rn");
- file.WriteString(str);
- file.Close();
-
- AfxMessageBox("新增成功!");
- SetDlgItemText(IDC_EDIT_SN,"");
- SetDlgItemText(IDC_EDIT_R1,"");
- SetDlgItemText(IDC_EDIT_R2,"");
- SetDlgItemText(IDC_EDIT_R3,"");
- SetDlgItemText(IDC_EDIT_R4,"");
- SetDlgItemText(IDC_EDIT_R5,"");
- SetDlgItemText(IDC_EDIT_R6,"");
- SetDlgItemText(IDC_EDIT_B,"");
- }