BOOL BrowseForFiles(ATL::CSimpleArray<CString>& listFiles, HWND hWnd) { listFiles.RemoveAll(); CFileDialog dlg(TRUE, 0, 0, OFN_NOCHANGEDIR | OFN_ENABLESIZING | OFN_EXPLORER | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT | OFN_NODEREFERENCELINKS); if(dlg.DoModal(hWnd) != IDOK) return FALSE; CString strPath = dlg.m_szFileName; CString strFilePath, strFileName; size_t nLen = strPath.GetLength(); TCHAR* pFileName = dlg.m_szFileName + nLen + 1; if(pFileName[0] == 0) { strFileName = pFileName; strFilePath = strPath + pFileName; listFiles.Add(strFilePath); return TRUE; } strPath += _T("\\"); while(pFileName != NULL && pFileName[0] != 0) { strFileName = pFileName; strFilePath = strPath + pFileName; listFiles.Add(strFilePath); nLen += strFileName.GetLength() + 1; pFileName = dlg.m_szFileName + nLen + 1; } return TRUE; }
void GetAllTreeItems(HWND hTreeView, HTREEITEM hItem, ATL::CSimpleArray<HTREEITEM>& arrItems, int& nIndex) { int nSize = TreeView_GetCount(hTreeView); arrItems.RemoveAll(); GetAllChildItems(hTreeView, TVI_ROOT, hItem, arrItems, nIndex); }