Click here to Skip to main content
15,896,726 members
Articles / General Programming / Algorithms

Iterative Implementation of Recursively Enumerating Files and Sub Folders

Rate me:
Please Sign up or sign in to vote.
4.64/5 (19 votes)
30 Dec 2010CPOL3 min read 59.7K   3.6K   51  
Yet another implementation to enumerate files
/* 
 * Kenny Liu
 * http://www.codeproject.com/Members/yonken
 *
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
 * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
 *
 * Permission is hereby granted to use or copy this program
 * for any purpose,  provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 */

#if !defined(AFX_OBJBROWSERDLG_H__A9B25B6D_B1EF_453B_9070_F867AB2800DD__INCLUDED_)
#define AFX_OBJBROWSERDLG_H__A9B25B6D_B1EF_453B_9070_F867AB2800DD__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "..\code_base\ObjInfoControl.h"
#include "..\code_base\ControlAnchor.h"

/*----------------------------------------------------------------------------*/
/* class CObjBrowserDlg
/*----------------------------------------------------------------------------*/

#define OBJBROWSERDLG_BASE		CDialog

class CObjBrowserDlg : public OBJBROWSERDLG_BASE
{
// Construction
public:
	CObjBrowserDlg(CWnd* pParent = NULL);	// standard constructor
	virtual ~CObjBrowserDlg();

// Dialog Data
	//{{AFX_DATA(CObjBrowserDlg)
	enum { IDD = IDD_OBJ_BROWSER_DIALOG };
	CFilterEdit		m_FilterEditCtrl;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CObjBrowserDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

public:
	BOOL			RefreshObjInfoList();

	CString			m_strFilterPattern;
protected:
	// For resizing.
	CControlAnchor	m_controlAnchor;

	CString			m_strTitlePrefix;

	void			SetTitlePrefixFromStringId(UINT nId);
	void			SetPromptTextFromStringId(UINT nId);
protected:
	virtual void	UpdateTitle();
	virtual BOOL	UpdateDisplayList();

	virtual IObjInfoController& GetObjInfoController() = 0;

	inline CObjInfoListCtrl& ObjInfoListCtrl()
	{
		return (CObjInfoListCtrl&)GetObjInfoController().GetControl();
	}

	inline CObjInfoHolder&	ObjInfoHolder()
	{
		return GetObjInfoController().GetInfoHolder();
	}

	inline CMultiColInfoMatcher& ObjInfoMatcher()
	{
		return (CMultiColInfoMatcher&)GetObjInfoController().GetMatcher();
	}

	virtual BOOL	OnDBClickObjInfoList(LPNMITEMACTIVATE pNMItemActivate);
	virtual BOOL	OnDBClickObjInfoList(int iItem, int iSubItem = -1);

	virtual void	OnGetMinMaxInfo(MINMAXINFO* lpMMI);

// Implementation
protected:
	HICON m_hIcon;

	CString			m_strTitleInfoFormat;

	// Generated message map functions
	//{{AFX_MSG(CObjBrowserDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnDestroy();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg LRESULT OnNcHitTest(CPoint point);
	afx_msg void OnDBClickObjInfoList(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnChangeEditFilter();

	afx_msg LRESULT OnUpdateObjInfoList(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnObjInfoListThreadEvent(WPARAM wParam, LPARAM lParam);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_OBJBROWSERDLG_H__A9B25B6D_B1EF_453B_9070_F867AB2800DD__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions