// RemarkDlg.cpp : implementation file // #include "stdafx.h" #include "vcdemo.h" #include "RemarkDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRemarkDlg dialog CRemarkDlg::CRemarkDlg(CWnd* pParent /*=NULL*/) : CDialog(CRemarkDlg::IDD, pParent) { //{{AFX_DATA_INIT(CRemarkDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CRemarkDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRemarkDlg) DDX_Control(pDX, IDC_LIST_Remark, m_ListRemark); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CRemarkDlg, CDialog) //{{AFX_MSG_MAP(CRemarkDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRemarkDlg message handlers BOOL CRemarkDlg::OnInitDialog() { CDialog::OnInitDialog(); // CStringArray strArray; CStdioFile file; BOOL bFlag; CFileFind finder; char path[255] = {0}; ::GetCurrentDirectory(255, path); strcat(path, "\\text.txt"); file.Open(path,CFile::modeRead); bFlag=finder.FindFile(path); if(!bFlag) { AfxMessageBox("没有找到文件!"); } else { CString str; while(file.ReadString(str)) { m_ListRemark.AddString(str); } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }