Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

CDirectoryChangeWatcher - ReadDirectoryChangesW all wrapped up

, 11 May 2002
This class wraps up ReadDirectoryChangesW.
cdirectorychangewatcher-05-12-2002_demo.zip
DirWatcher.dsp
DirWatcher.dsw
DirWatcher_ScreenShot2.jpg
SetFiltersDlg.jpg
TestPatterns.bmp
res
DirWatcher.ico
cdirectorychangewatcher-05-12-2002_src.zip
cdirectorychangewatcher-11-24-2001_src.zip
demowatcher.zip
DirWatcher.exe
DirWatcherU.exe
directorychangewatcher_demo.zip
DirWatcher.clw
DirWatcher.dsp
DirWatcher.dsw
DirWatcher.ico
DirWatcher.exe
directorychangewatcher_src.zip
dirwatcher-11-24-2001_demo.zip
DirWatcher.ico
DirWatcher.dsp
DirWatcher.dsw
DirWatcher.exe
/* 
DESCRIPTION:
	CFolderDialog  - Folder Selection Dialog Class

NOTES:
	Copyright(C) Armen Hakobyan, 2002
	mailto:armenh@cit.am
	
VERSION HISTORY:
	24 Mar 2002 - First release
*/

#pragma once

class CFolderDialog : public CCommonDialog
{
	DECLARE_DYNAMIC(CFolderDialog)

public:
	explicit CFolderDialog(LPCTSTR lpszTitle = NULL, 
			 LPCTSTR lpszFolderName = NULL, CWnd* pParentWnd = NULL,
			 UINT uFlags = BIF_RETURNONLYFSDIRS);
	virtual ~CFolderDialog();

public:
	virtual int		DoModal(void);
	
public:	
	AFX_INLINE LPCTSTR	GetFolderPath(void) const;
	AFX_INLINE LPCTSTR	GetFolderDisplayName(void) const;
	AFX_INLINE int		GetFolderImageIndex(void) const;	
	AFX_INLINE BOOL		SetSelectedFolder(LPCTSTR lpszPath);

	AFX_INLINE BROWSEINFO&		 GetBI(void);
	AFX_INLINE const BROWSEINFO& GetBI(void) const;
	
protected:	
	BROWSEINFO	m_bi;
	TCHAR		m_szFolderPath[MAX_PATH];
	TCHAR		m_szSelectedPath[MAX_PATH];
	TCHAR		m_szFolderDisplayName[MAX_PATH];

protected:
	DECLARE_MESSAGE_MAP()
	
	virtual void OnInitialized(void);
	virtual int	 OnValidateFailed(LPCTSTR lpstrFolderPath);
	virtual void OnSelChanged(LPITEMIDLIST /*pItemIDList*/);

protected:
	AFX_INLINE void EnableOK(BOOL bEnable = TRUE);
	AFX_INLINE void SetSelection(LPITEMIDLIST pItemIDList);
	AFX_INLINE void SetSelection(LPCTSTR lpszFolderPath);
	AFX_INLINE void SetStatusText(LPCTSTR lpszText);
	
private:
	HWND m_hWnd; // used only in the callback function
	static INT CALLBACK BrowseCallbackProc(
		HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
};

AFX_INLINE BOOL CFolderDialog::SetSelectedFolder(LPCTSTR lpszPath)
	{ ASSERT (lpszPath != NULL);
		return (lstrcpy(m_szSelectedPath, lpszPath) != NULL); }

AFX_INLINE BROWSEINFO& CFolderDialog::GetBI(void)
	{ return m_bi; }

AFX_INLINE const BROWSEINFO& CFolderDialog::GetBI(void) const
	{ return m_bi; }

// filled after a call to DoModal

AFX_INLINE LPCTSTR CFolderDialog::GetFolderPath(void) const
	{ return m_szFolderPath; }

AFX_INLINE LPCTSTR CFolderDialog::GetFolderDisplayName(void) const
	{ return m_szFolderDisplayName; }

AFX_INLINE int CFolderDialog::GetFolderImageIndex(void) const
	{ return m_bi.iImage; }

// Commands - valid to call only from handlers

AFX_INLINE void CFolderDialog::EnableOK(BOOL bEnable /*TRUE*/)
	{ ASSERT(m_hWnd != NULL); 
		::SendMessage(m_hWnd, BFFM_ENABLEOK, bEnable, 0L);}

AFX_INLINE void CFolderDialog::SetSelection(LPITEMIDLIST pItemIDList)
	{ ASSERT(m_hWnd != NULL); 
		::SendMessage(m_hWnd, BFFM_SETSELECTION, FALSE, (LPARAM)pItemIDList); }

AFX_INLINE void CFolderDialog::SetSelection(LPCTSTR lpszFolderPath)
	{ ASSERT(m_hWnd != NULL);
		::SendMessage(m_hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)lpszFolderPath); }

AFX_INLINE void CFolderDialog::SetStatusText(LPCTSTR lpszText)
	{ ASSERT(m_hWnd != NULL);
		::SendMessage(m_hWnd, BFFM_SETSTATUSTEXT, 0L, (LPARAM)lpszText);}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Wes Jones
Web Developer
United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 12 May 2002
Article Copyright 2001 by Wes Jones
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid