1

リストコントロールを使用してグリッド関数を作成しました。リストには2つの列があります。データと名前。

ユーザーはファイルを選択する必要があります。ファイル内のデータは最初の列「DATA」に表示され、ファイル名は2番目の列「NAME」に表示されます。コードを書きましたが、リストに何も表示されません

CFileFind finder;
bool bFound;
CString filename = "C:\\ Location\\*.txt";
bFound = finder.FindFile(filename);

if(bFound) 
{

   while(bFound) 
   {
        bFound = finder.FindNextFile();
        if(bFound)
        {
            m_List.AddString(finder.GetFileName()); //This is where the actual data is added 
        }
   }
   CStdioFile files;
   CFileException exp;
   CString strLine;  

   if (files.Open(filename, CFile::modeRead, &exp))
   {
      while(files.ReadString(strLine)){}
   }
}
void CuserspecificationDlg::InsertItems()
{
       HWND hWnd = ::GetDlgItem(m_hWnd, IDC_LIST1);
       // Set the LVCOLUMN structure with the required 
       // column information
         ..
         .. 
         SetCell(hWnd,out,1,1);   // where out is the Cstring variable for edit control  
}

何が間違いでしょうか?

4

1 に答える 1

2

リスト ボックスの使用方法については、こちらのチュートリアルを参照してください。コントロール ウィザードを介してリスト ボックスにマップされるタイプ CListBox のメンバー変数を定義できます。

于 2012-07-30T16:43:56.553 に答える