-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathFilteredFolderDlg.h
114 lines (90 loc) · 3.23 KB
/
FilteredFolderDlg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//////////////////////////////////////////////////////////////////////
// Custom filtering is based on Arik Poznanski's article
// C# does Shell, Part 1
// http://www.codeproject.com/csharp/csdoesshell1.asp
//////////////////////////////////////////////////////////////////////
#ifndef __FILTERED_FOLDERDLG_H__
#define __FILTERED_FOLDERDLG_H__
#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 )
#pragma once
#endif
#ifndef __FOLDERDLG_H__
#include "folderdlg.h"
#endif
#if defined ( __IFolderFilterSite_FWD_DEFINED__ )
#if defined ( __IFolderFilterSite_INTERFACE_DEFINED__ )
#if defined ( __IFolderFilter_FWD_DEFINED__ )
#if defined ( __IFolderFilter_INTERFACE_DEFINED__ )
#define USE_XP_FILTRATION
#endif
#endif
#endif
#endif
//////////////////////////////////////////////////////////////////////
#ifdef USE_XP_FILTRATION
//////////////////////////////////////////////////////////////////////
#ifndef _INC_SHLWAPI
#include < shlwapi.h > // Required for the StrRet and Path functions
#endif
#pragma comment( lib, "shlwapi.lib" )
//////////////////////////////////////////////////////////////////////
// IMyFolderFilter
class IMyFolderFilter : public IFolderFilter
{
public:
IMyFolderFilter(VOID);
public: // IUnknown implementation
STDMETHOD(QueryInterface)(IN REFIID /*riid*/, IN OUT LPVOID* /*ppvObj*/);
STDMETHOD_(ULONG, AddRef)(VOID);
STDMETHOD_(ULONG, Release)(VOID);
public: // IFolderFilter implementation
STDMETHOD(ShouldShow)(IN IShellFolder* /*pIShellFolder*/, IN LPCITEMIDLIST /*pidlFolder*/, IN LPCITEMIDLIST IN /*pidlItem*/);
STDMETHOD(GetEnumFlags)(IN IShellFolder* /*pIShellFolder*/, IN LPCITEMIDLIST /*pidlFolder*/, IN HWND* /*phWnd*/, OUT LPDWORD /*pdwFlags*/);
protected:
ULONG m_ulRef;
public:
LPCTSTR m_pszFilter;
};
//////////////////////////////////////////////////////////////////////
// CFilteredFolderDialog class
class CFilteredFolderDialog : public CFolderDialog
{
public:
CFilteredFolderDialog(LPCTSTR pszTitle = NULL,
LPCTSTR pszSelPath = NULL,
CWnd* pParentWnd = NULL,
UINT uFlags = BIF_RETURNONLYFSDIRS);
virtual ~CFilteredFolderDialog(VOID);
public:
VOID SetFilter(IN LPCTSTR pszFilter);
protected:
virtual VOID OnIUnknown(IN IUnknown* pIUnknown);
protected:
//CStringArray m_straFilters;
LPCTSTR m_pszFilter;
IMyFolderFilter* m_pIMyFolderFilter;
};
//////////////////////////////////////////////////////////////////////
// CMyFolderFilter class
//class CFolderFilter : public CCmdTarget
//{
// friend class CFilteredFolderDialog;
//
//public: // IFolderFilter methods
//
// DECLARE_DYNCREATE( CFolderFilter );
// DECLARE_INTERFACE_MAP();
//
// BEGIN_INTERFACE_PART( FolderFilterObj, IFolderFilter )
// STDMETHOD( ShouldShow )( IShellFolder* pIShellFolder, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlItem );
// STDMETHOD( GetEnumFlags )( IShellFolder* pIShellFolder, LPCITEMIDLIST pidlFolder, HWND* phWnd, LPDWORD pdwFlags );
// END_INTERFACE_PART( FolderFilterObj )
//
//protected:
// CStringArray* m_pStraFilters;
//};
//////////////////////////////////////////////////////////////////////
#endif // USE_XP_FILTRATION
//////////////////////////////////////////////////////////////////////
#endif // __FILTERED_FOLDERDLG_H__
//////////////////////////////////////////////////////////////////////