2010/10/18

CFileDialog 여러개의 파일 선택하기

CFileDialog dlgFile( TRUE, NULL, NULL, 
OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT,
_T("All files (*.)|*.*") );

int nFileNum = 100;
int nFileNameSize = MAX_PATH + 1;
int nBufSize = nFileNameSize * nFileNum + 1;
TCHAR* szFileNames = new TCHAR[ nBufSize ];

szFileNames[ 0 ] = NULL;
szFileNames[ nBufSize - 1 ] = NULL;

dlgFile.m_ofn.lpstrFile = szFileNames;
dlgFile.m_ofn.nMaxFile = nBufSize;

if ( dlgFile.DoModal() == IDOK )
{
POSITION pos = dlgFile.GetStartPosition();

while ( pos != NULL )
{
CString strFile = dlgFile.GetNextPathName( pos );
}
}

delete [] szFileNames;
<

Original Post : http://neodreamer-dev.tistory.com/470

No comments :

Post a Comment