FileManage3.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // FileManage3.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. //#include "ZLSoftC.h"
  5. #include "YLGL.h"
  6. #include "FileManage3.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // FileManage3 dialog
  14. FileManage3::FileManage3(CWnd* pParent /*=NULL*/)
  15. : CDialog(FileManage3::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(FileManage3)
  18. m_path = _T("");
  19. m_bz = _T("");
  20. m_curposition = _T("");
  21. m_bModify=0;
  22. m_bfirst=1;
  23. //}}AFX_DATA_INIT
  24. }
  25. void FileManage3::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CDialog::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(FileManage3)
  29. DDX_Control(pDX, IDC_COMBO2, m_combolevel);
  30. DDX_Text(pDX, IDC_EDIT3, m_path);
  31. DDX_Text(pDX, IDC_EDIT7, m_bz);
  32. DDX_Text(pDX, IDC_EDIT2, m_curposition);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(FileManage3, CDialog)
  36. //{{AFX_MSG_MAP(FileManage3)
  37. ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
  38. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  39. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  40. //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42. /////////////////////////////////////////////////////////////////////////////
  43. // FileManage3 message handlers
  44. BOOL FileManage3::OnInitDialog()
  45. {
  46. CDialog::OnInitDialog();
  47. // SetDlgFont( this );
  48. // TODO: Add extra initialization here
  49. m_combolevel.AddString("1级");
  50. m_combolevel.AddString("2级");
  51. m_combolevel.AddString("3级");
  52. m_combolevel.AddString("4级");
  53. m_combolevel.AddString("5级");
  54. m_combolevel.SetCurSel(0);
  55. if(m_bModify)
  56. {
  57. SetWindowText("修改文件资料");
  58. m_combolevel.SetCurSel(m_combolevel.FindString(0, level));
  59. }
  60. return TRUE; // return TRUE unless you set the focus to a control
  61. // EXCEPTION: OCX Property Pages should return FALSE
  62. }
  63. void FileManage3::OnButton7() //存入当前文件柜;
  64. {
  65. // TODO: Add your control notification handler code here
  66. UpdateData();
  67. if(m_path=="" && m_bModify==0)
  68. {
  69. AfxMessageBox("未选择存入文件!", MB_ICONINFORMATION);return;
  70. }
  71. int pos=m_combolevel.GetCurSel();
  72. if(pos==-1)
  73. {
  74. AfxMessageBox("请选择阅读级别!", MB_ICONINFORMATION);return;
  75. }
  76. m_combolevel.GetLBText(pos, level);
  77. CDialog::OnOK();
  78. }
  79. void FileManage3::OnBUTclose()
  80. {
  81. // TODO: Add your control notification handler code here
  82. CDialog::OnCancel();
  83. }
  84. void FileManage3::OnButton3()
  85. {
  86. // TODO: Add your control notification handler code here
  87. UpdateData();
  88. CFileDialog fdlg(true, NULL,"", OFN_ALLOWMULTISELECT, "文档(*.*)|*.*||");
  89. TCHAR szBuffer[60000]={0};
  90. fdlg.m_ofn.lpstrFile = szBuffer;
  91. fdlg.m_ofn.nMaxFile = 60000;
  92. if(fdlg.DoModal ()!=IDOK)return;
  93. POSITION pos=fdlg.GetStartPosition ();
  94. if(m_bModify && m_bfirst)
  95. {
  96. m_bfirst=0;
  97. m_path="";
  98. }
  99. while(pos!=NULL)
  100. {
  101. m_path+=fdlg.GetNextPathName (pos);
  102. m_path+=";";
  103. }
  104. UpdateData(0);
  105. }