CFileDialog를 이용하여 다중 파일을 선택하는 방법..
다중파일 선택하는 방법만 많이 나와있지 여러개 선택할때 14개 이상 선택이 안되던 내 버그에 대한글을
찾는것은 쉽지 않았다..
결론은 메모리문제.. 메모리문제를 해결하기위한 코드를 추가한 방법이다.
선택된 파일을 리스트박스에 추가해준다.
-----------------------------------------------------------------------------------------------
CString str = _T("JPEG(*.jpg)|*.jpg|"); // 선택할 파일 종류
CString File;
CString strFileList;
CFileDialog dlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, str, this);
const int c_cMaxFiles = 400 /*선택할 파일 숫자*/ ; // 메모리 부족현상으로 확장 안해주면 몇개 못씀
const int c_cbBuffSize = (c_cMaxFiles * (MAX_PATH + 1)) + 1;
dlg.GetOFN().lpstrFile = strFileList.GetBuffer(c_cbBuffSize);
dlg.GetOFN().nMaxFile = c_cbBuffSize;
if( dlg.DoModal() == IDOK)
{
for(POSITION pos=dlg.GetStartPosition(); pos != NULL;)
{
// 전체삭제는 ResetContent
File = dlg.GetNextPathName(pos);
m_TrainingList.AddString(File);
}
}
'Programming > C, C++, MFC' 카테고리의 다른 글
GetDlgItem() 함수를 이용하기 (0) | 2013.07.03 |
---|---|
Memory Leaks 어디서 누수가 일어나는지 잡아보자.. (0) | 2013.07.01 |
#define 에 관한 내용 (0) | 2013.06.07 |
MFC TabControl 사용법 (2) | 2013.04.30 |
MFC Picture Control 에 BMP 파일 출력하기 (1) | 2013.04.02 |