RemarkDlg.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // RemarkDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "vcdemo.h"
  5. #include "RemarkDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CRemarkDlg dialog
  13. CRemarkDlg::CRemarkDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CRemarkDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CRemarkDlg)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. }
  20. void CRemarkDlg::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(CRemarkDlg)
  24. DDX_Control(pDX, IDC_LIST_Remark, m_ListRemark);
  25. //}}AFX_DATA_MAP
  26. }
  27. BEGIN_MESSAGE_MAP(CRemarkDlg, CDialog)
  28. //{{AFX_MSG_MAP(CRemarkDlg)
  29. //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CRemarkDlg message handlers
  33. BOOL CRemarkDlg::OnInitDialog()
  34. {
  35. CDialog::OnInitDialog();
  36. // CStringArray strArray;
  37. CStdioFile file;
  38. BOOL bFlag;
  39. CFileFind finder;
  40. char path[255] = {0};
  41. ::GetCurrentDirectory(255, path);
  42. strcat(path, "\\text.txt");
  43. file.Open(path,CFile::modeRead);
  44. bFlag=finder.FindFile(path);
  45. if(!bFlag)
  46. {
  47. AfxMessageBox("ûÓÐÕÒµ½Îļþ£¡");
  48. }
  49. else
  50. {
  51. CString str;
  52. while(file.ReadString(str))
  53. {
  54. m_ListRemark.AddString(str);
  55. }
  56. }
  57. return TRUE; // return TRUE unless you set the focus to a control
  58. // EXCEPTION: OCX Property Pages should return FALSE
  59. }