1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 // EXIMPORTDlg.h : // #pragma once #include "PageExport.h" #include "PageImport.h" // CEXIMPORTDlg class CEXIMPORTDlg : public CDialogEx { // public: CEXIMPORTDlg(CWnd* pParent = NULL); // // enum { IDD = IDD_EXIMPORT_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV // protected: HICON m_hIcon; // virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: afx_msg void OnTcnSelchangeTabroom(NMHDR *pNMHDR, LRESULT *pResult); private: CPageExport m_PageExport; CPageImport m_PageImport; }; EXIMPORTDlg.cpp 1 2 3 4 5 6 7 8 9 10 11 * * Visual Studio V2013 * * * V1.0 * * ------------------------------------------------------------ */ // EXIMPORTDlg.cpp : //
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 CDialogEx::OnPaint(); } } HCURSOR CEXIMPORTDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } void CEXIMPORTDlg::OnTcnSelchangeTabroom(NMHDR *pNMHDR, LRESULT *pResult) { // TODO: INT CurSel = ((CTabCtrl*)GetDlgItem(IDC_TABROOM))->GetCurSel(); switch (CurSel) { case 0: m_PageExport.ShowWindow(TRUE); m_PageImport.ShowWindow(FALSE); break; case 1: m_PageExport.ShowWindow(FALSE); m_PageImport.ShowWindow(TRUE); } *pResult = 0; } PageExport.h 1 2 3 4 5 6 7 8 9 10 11 12 13 #pragma once // CPageExport class CPageExport : public CDialogEx { DECLARE_DYNAMIC(CPageExport) public: CPageExport(CWnd* pParent = NULL); // virtual ~CPageExport();
14 15 16 17 18 19 20 21 22 23 24 // enum { IDD = IDD_PAGEEXPORT }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV DECLARE_MESSAGE_MAP() public: afx_msg void OnBnClickedButtonsavefile(); afx_msg void OnBnClickedButtonexport(); }; PageExport.cpp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 // PageExport.cpp : // #include "stdafx.h" #include "EXIMPORT.h" #include "PageExport.h" #include "afxdialogex.h" #include "..\\FaceId\\Source\\FaceId.h" #include "..\\FaceId\\Source\\FaceId_Item.h" // CPageExport IMPLEMENT_DYNAMIC(CPageExport, CDialogEx) CPageExport::CPageExport(CWnd* pParent /*=NULL*/) : CDialogEx(CPageExport::IDD, pParent) { } CPageExport::~CPageExport() { } void CPageExport::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CPageExport, CDialogEx) ON_BN_CLICKED(IDC_BUTTONSAVEFILE, &CPageExport::OnBnClickedButtonsavefile) ON_BN_CLICKED(IDC_BUTTONEXPORT, &CPageExport::OnBnClickedButtonexport) END_MESSAGE_MAP() // CPageExport // void CPageExport::OnBnClickedButtonsavefile() {
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 if (nReadChars > 0) { EmployeesFile.WriteString(Answer.c_str()); EmployeesFile.WriteString(TEXT("\n")); SaveCount++; } } } EmployeesFile.Close(); TCHAR Information[256]; StringCchPrintf(Information, _countof(Information), SaveCount, Total); MessageBox(Information, MB_OK | MB_ICONINFORMATION | MB_DEFBUTTON1); } } else { // TCHAR Information[256]; StringCchPrintf(Information, _countof(Information), nReadChars); MessageBox(Information, MB_OK | MB_ICONERROR | MB_DEFBUTTON1); } } catch (DWORD dwErrorCode) { // TCHAR Information[256]; StringCchPrintf(Information, _countof(Information), dwErrorCode); MessageBox(Information, | MB_ICONERROR | MB_DEFBUTTON1); } catch (...) { } // if (TcpClient != NULL) { TcpClient = NULL; } } PageImport.h 1 2 3 4 5 6 7 8 9 10 #pragma once // CPageImport class CPageImport : public CDialogEx { DECLARE_DYNAMIC(CPageImport) public:
146 147 148 149 150 151 152 153 154 155 156 157 158 } catch (...) { } // if (TcpClient != NULL) { TcpClient->Close(); TcpClient = NULL; } }