filelist.cpp
来自「《Visual C++ 6.0实例教程》配套代码」· C++ 代码 · 共 66 行
CPP
66 行
// FileList.cpp : implementation file
//
#include "stdafx.h"
#include "FileList.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileList
CFileList::CFileList()
{
m_strFilter = "*.*";
}
CFileList::~CFileList()
{
}
BEGIN_MESSAGE_MAP(CFileList, CListBox)
//{{AFX_MSG_MAP(CFileList)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFileList message handlers
void CFileList::FillListBox(CString csPath)
{
int nDir = 0;
if (csPath.Right(1) != '\\')
csPath += '\\';
csPath += m_strFilter;
ResetContent();
CFileFind FoundFiles;
BOOL bContinue = FoundFiles.FindFile(csPath);
while (bContinue == TRUE)
{
bContinue = FoundFiles.FindNextFile();
int nIndex = GetCount();
if (FoundFiles.IsDirectory())
continue;
this->AddString(FoundFiles.GetFileName()); //, nIcon);
}
FoundFiles.Close();
}
void CFileList::SetFilter(CString strFilter)
{
m_strFilter = strFilter;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?