// myofn.cpp

#include "myofn.h"

namespace mylib
{

CMyOfn::CMyOfn()
{
	m_szFileName[0] = 0;
	::ZeroMemory(&m_ofn, sizeof(OPENFILENAME));
	m_ofn.lStructSize = sizeof(OPENFILENAME);
	m_ofn.hwndOwner = 0;
	m_ofn.lpstrFile = m_szFileName;
	m_ofn.nMaxFile = MAX_FILENAME;
	m_ofn.lpstrFilter = 
		_T("All Documents\0*.txt;*.bmp;*.jpg\0Text\0*.txt\0Images\0*.bmp;*.jpg\0All Files\0*.*\0");
	m_ofn.nFilterIndex = 1;
	m_ofn.lpstrFileTitle = 0;
	m_ofn.nMaxFileTitle = 0;
	m_ofn.lpstrInitialDir = 0;
	m_ofn.Flags = (OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST);
}

CMyOfn::~CMyOfn()
{
}

BOOL
CMyOfn::GetOpenFileName()
{
	return ::GetOpenFileName(&m_ofn);
}

BOOL
CMyOfn::GetSaveFileName()
{
	return ::GetSaveFileName(&m_ofn);
}

const TCHAR*
CMyOfn::FileName() const
{
	return m_szFileName;
}

}	// namespace mylib
