16#if (_WIN32_WINNT >= 0x0500) && defined(CFileDialog) && defined(__MSVCPP6__)
27 LPTSTR lpstrCustomFilter;
32 LPTSTR lpstrFileTitle;
34 LPCTSTR lpstrInitialDir;
41 LPOFNHOOKPROC lpfnHook;
42 LPCTSTR lpTemplateName;
46class CFileDialog :
public CCommonDialog
48 DECLARE_DYNAMIC(CFileDialog)
55 CFileDialog(BOOL bOpenFileDialog,
56 LPCTSTR lpszDefExt = NULL,
57 LPCTSTR lpszFileName = NULL,
58 DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
59 LPCTSTR lpszFilter = NULL,
60 CWnd* pParentWnd = NULL);
63 virtual int DoModal();
67 CString GetPathName()
const;
68 CString GetFileName()
const;
69 CString GetFileExt()
const;
70 CString GetFileTitle()
const;
71 BOOL GetReadOnlyPref()
const;
74 POSITION GetStartPosition()
const;
75 CString GetNextPathName(POSITION& pos)
const;
78 void SetTemplate(UINT nWin3ID, UINT nWin4ID);
79 void SetTemplate(LPCTSTR lpWin3ID, LPCTSTR lpWin4ID);
82 CString GetFolderPath()
const;
83 void SetControlText(
int nID, LPCSTR lpsz);
84 void HideControl(
int nID);
85 void SetDefExt(LPCSTR lpsz);
89 friend UINT CALLBACK _AfxCommDlgProc(HWND, UINT, WPARAM, LPARAM);
90 virtual UINT OnShareViolation(LPCTSTR lpszPathName);
91 virtual BOOL OnFileNameOK();
92 virtual void OnLBSelChangedNotify(UINT nIDBox, UINT iCurSel, UINT nCode);
95 virtual void OnInitDone();
96 virtual void OnFileNameChange();
97 virtual void OnFolderChange();
98 virtual void OnTypeChange();
103 virtual void Dump(CDumpContext& dc)
const;
107 BOOL m_bOpenFileDialog;
110 TCHAR m_szFileTitle[64];
111 TCHAR m_szFileName[_MAX_PATH];
113 OPENFILENAME* m_pofnTemp;
115 virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
174 DEFSUPER(CFileDialog);
175 enum { E_BufferLength = 100000 };
241 LPCTSTR lpszDefExt = NULL,
242 LPCTSTR lpszFileName = NULL,
243 DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
244 LPCTSTR lpszFilter = NULL,
245 CWnd* pParentWnd = NULL,
246 BOOL bVistaStyle = FALSE
248 ) : _super(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
250 ) : _super(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd, 0, bVistaStyle)
253 m_strNameBuffer = lpszFileName;
254 m_ofn.nMaxFile = E_BufferLength;
255 m_ofn.lpstrFile = m_strNameBuffer.GetBuffer(E_BufferLength + 1);
265 m_initialPath = lpszPath;
266 m_ofn.lpstrInitialDir = m_initialPath;
277 _astrNames.RemoveAll();
278 POSITION pos = GetStartPosition();
279 while ( pos != NULL )
281 _astrNames.Add(GetNextPathName(pos));
283 return _astrNames.GetSize();
293 return _super::GetPathName();
306 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
308 if ( message == WM_INITDIALOG )
310 GetNextWindow(GW_HWNDPREV)->ShowWindow(SW_HIDE);
312 return _super::WindowProc(message, wParam, lParam);
316 CString m_strNameBuffer;
317 CString m_initialPath;
CString GetPathName(void) const
[取得] 選択フルパス名取得.
INT_PTR GetPathNames(CStringArray &_astrNames)
[取得] 選択フルパス名取得.
void SetInitialPath(LPCTSTR lpszPath)
[設定] 最初のディレクトリ指定.
CFileDialogEx(BOOL bOpenFileDialog, LPCTSTR lpszDefExt=NULL, LPCTSTR lpszFileName=NULL, DWORD dwFlags=OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter=NULL, CWnd *pParentWnd=NULL, BOOL bVistaStyle=FALSE)
コンストラクタ
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.