// FileManage3.cpp : implementation file // #include "stdafx.h" //#include "ZLSoftC.h" #include "YLGL.h" #include "FileManage3.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // FileManage3 dialog FileManage3::FileManage3(CWnd* pParent /*=NULL*/) : CDialog(FileManage3::IDD, pParent) { //{{AFX_DATA_INIT(FileManage3) m_path = _T(""); m_bz = _T(""); m_curposition = _T(""); m_bModify=0; m_bfirst=1; //}}AFX_DATA_INIT } void FileManage3::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(FileManage3) DDX_Control(pDX, IDC_COMBO2, m_combolevel); DDX_Text(pDX, IDC_EDIT3, m_path); DDX_Text(pDX, IDC_EDIT7, m_bz); DDX_Text(pDX, IDC_EDIT2, m_curposition); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(FileManage3, CDialog) //{{AFX_MSG_MAP(FileManage3) ON_BN_CLICKED(IDC_BUTTON7, OnButton7) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // FileManage3 message handlers BOOL FileManage3::OnInitDialog() { CDialog::OnInitDialog(); // SetDlgFont( this ); // TODO: Add extra initialization here m_combolevel.AddString("1级"); m_combolevel.AddString("2级"); m_combolevel.AddString("3级"); m_combolevel.AddString("4级"); m_combolevel.AddString("5级"); m_combolevel.SetCurSel(0); if(m_bModify) { SetWindowText("修改文件资料"); m_combolevel.SetCurSel(m_combolevel.FindString(0, level)); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void FileManage3::OnButton7() //存入当前文件柜; { // TODO: Add your control notification handler code here UpdateData(); if(m_path=="" && m_bModify==0) { AfxMessageBox("未选择存入文件!", MB_ICONINFORMATION);return; } int pos=m_combolevel.GetCurSel(); if(pos==-1) { AfxMessageBox("请选择阅读级别!", MB_ICONINFORMATION);return; } m_combolevel.GetLBText(pos, level); CDialog::OnOK(); } void FileManage3::OnBUTclose() { // TODO: Add your control notification handler code here CDialog::OnCancel(); } void FileManage3::OnButton3() { // TODO: Add your control notification handler code here UpdateData(); CFileDialog fdlg(true, NULL,"", OFN_ALLOWMULTISELECT, "文档(*.*)|*.*||"); TCHAR szBuffer[60000]={0}; fdlg.m_ofn.lpstrFile = szBuffer; fdlg.m_ofn.nMaxFile = 60000; if(fdlg.DoModal ()!=IDOK)return; POSITION pos=fdlg.GetStartPosition (); if(m_bModify && m_bfirst) { m_bfirst=0; m_path=""; } while(pos!=NULL) { m_path+=fdlg.GetNextPathName (pos); m_path+=";"; } UpdateData(0); }