Click here to Skip to main content
15,891,184 members
Articles / Desktop Programming / MFC

VssReporter 2.1 - A Visual SourceSafe reporting tool for build administrators

Rate me:
Please Sign up or sign in to vote.
4.88/5 (100 votes)
25 Mar 200610 min read 626K   8.9K   162  
A support tool to allow those performing builds to independently determine exactly what source files have been changed and by whom
/* 
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

#define BIF_BROWSENONETWORK		0x00008000
#define BIF_BROWSEFIXEDONLY		0x00010000
#define BIF_BROWSENOREADONLY	0x00020000
#define BIF_BROWSENOROOTDIR		0x00040000

#ifndef BIF_NEWDIALOGSTYLE
#define BIF_NEWDIALOGSTYLE		0x0040
#endif

#include <afxdlgs.h>

class CFolderDialog : public CCommonDialog
{
	DECLARE_DYNAMIC(CFolderDialog)

public:
	explicit CFolderDialog(LPCTSTR lpszTitle = NULL, 
			 LPCTSTR lpszFolderName = NULL, CWnd* pParentWnd = NULL,
			 UINT uFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE);
	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, 0L, bEnable);}

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


Written By
Software Developer Maptek
Australia Australia
.dan.g. is a naturalised Australian and has been developing commercial windows software since 1998.

Comments and Discussions