×

Loading...
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!

More details

Client needs a GUI application to generate chart from text-based file. In more words, the interface should look like this, left part of screen will be a file list showing all the text files in a specified directory, right part will be several buttons. When user selects one file and clicks on one button the system will generate a chart for user to print and save.

The following is the data format sample:

sample.txt
061--120 15 4 3
121--180 15 5 5
181--240 15 7 5

Any suggestions will be appreciated, thanks
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / C++ MFC ListBox
    我准备建立一个LLISTBOX 在MFC DIALOG WINDOWS, 有没有比较好的方法从一个目录,比如C:\FILES,读出所有文件的名字,然后加到ITEM LIST 里.换句话说就是列出某个目录下的所有文件.

    谢谢了
    • In more words, the business requirement is showing all files in one directory
    • More details
      Client needs a GUI application to generate chart from text-based file. In more words, the interface should look like this, left part of screen will be a file list showing all the text files in a specified directory, right part will be several buttons. When user selects one file and clicks on one button the system will generate a chart for user to print and save.

      The following is the data format sample:

      sample.txt
      061--120 15 4 3
      121--180 15 5 5
      181--240 15 7 5

      Any suggestions will be appreciated, thanks
    • pls, I need your help
    • 可以,用CFileDialog类派生,做些修改。
    • 1,取得给定路径下的所有文件名(包括子文件夹),给你个函数。
      CStringList m_strFileList;

      bool CEnumFiles::EnumFiles(const char* szFolder)
      {
      CString szFileFind(szFolder);
      szFileFind += m_szFind;

      WIN32_FIND_DATA fd;
      HANDLE hFind = FindFirstFile(szFileFind,&fd);
      while(hFind != INVALID_HANDLE_VALUE)
      {
      if(m_pHEvent != NULL)
      {
      if(::WaitForSingleObject(*m_pHEvent,0) == WAIT_OBJECT_0)
      return false;
      }

      if(m_bSubFolder && (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
      {
      if(strcmp(fd.cFileName,".")!=0 && strcmp(fd.cFileName,"..")!=0)
      {
      CString szSubFolder(szFolder);
      szSubFolder += fd.cFileName;
      szSubFolder += '\\';
      if(EnumFiles(szSubFolder)==false)
      return false;
      }
      }
      else
      {
      CString szFileName(szFolder);
      szFileName += fd.cFileName;
      m_strFileList.AddTail(szFileName);
      }
      if(!FindNextFile(hFind,&fd))
      break;
      }
      FindClose(hFind);
      return true;
      }

      2,把得到的文件名夹道clistbox。
      放个CListBox控件,用AddString 方法加就行乐呀。