#ifndef _FILEDIALOGST_H_
#define _FILEDIALOGST_H_

#include <Shlobj.h>

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

class CFileDialogST  
{
public:
	CFileDialogST(BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL);
	CFileDialogST();
	virtual ~CFileDialogST();

	virtual int DoModal();

	CString GetPathName() const;
	CString GetFileName() const;
	CString GetFileTitle() const;
	CString GetFileExt() const;
	CString GetFileDir() const;
	CString GetFileDrive() const;

	POSITION GetStartPosition() const;
	CString GetNextPathName(POSITION& pos) const;

	BOOL GetReadOnlyPref() const;

	int SelectFolder(LPCTSTR lpszTitle = NULL, LPCTSTR lpszStartPath = NULL, UINT ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS, CWnd* pParentWnd = NULL,LPCTSTR lpszRoot = NULL);
	CString GetSelectedFolder() const;

	static short GetVersionI()		{return 13;}
	static LPCTSTR GetVersionC()	{return (LPCTSTR)_T("1.3");}

private:
#if (_WIN32_WINNT < 0x0500)
	struct OPENFILENAMEEX : public OPENFILENAME 
	{ 
		void*	pvReserved;
		DWORD	dwReserved;
		DWORD	FlagsEx;
	};
#endif

public:
#if (_WIN32_WINNT >= 0x0500)
	OPENFILENAME	m_ofn;
#else
	OPENFILENAMEEX	m_ofn;
#endif
	BOOL			m_bOpenFileDialog;

private:
	static int __stdcall BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);

	TCHAR			m_szFile[MAX_PATH];
	TCHAR			m_szFileTitle[MAX_PATH];
	TCHAR			m_szSelectedFolder[MAX_PATH];
};

#endif 
