// DlgModelessBase.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include "DynamicDraw.h"		// For FFGetApp().
#include "RegData.h"			// For GetLocalAppName().
#include "UtilWin.h"			// For FFJustifyToMonitor.
#include "UtilErr.h"			// For FFThrowMiscUnknown.
#include "DlgModelessBase.h"	// This header.

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFCDlgModelessBase _xZkqqHx_iDfPiDeDiDeBiDiNiDeP_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::CFCDlgModelessBase
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgGiDhEiDeIiDiLiDgHiDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
CFCDlgModelessBase::CFCDlgModelessBase ()
					: BASE_CLASS()
{
	//{{AFX_DATA_INIT(CFCDlgModelessBase)
		// _xZkqqHx_iDiBiDiC_xHqqkZx_ - ClassWizard _xZkqqHx_iCmNiClBiCmMiImKjChFiCmJiDhNiDgCiDhDiDjDiDePjHhAiCmMiDhNiDeOiDiNiCpAjCmHiJmBiCnMiClNiCmNiNoNiPjMiClFiCnMiClHiBeC_xHqqkZx_
	//}}AFX_DATA_INIT

	//----- _xZkqqHx_iDiGiBfLiDfFjFmPjAjE_xHqqkZx_ -----
	// _xZkqqHx_iDfPiDeDiDeBiDiNiDePiCmM_xHqqkZx_ID_xZkqqHx_iBeCiDiMiDfHiDfIiDgHiDiKiCnGiCmMjFnLjBlGiCmJiOgHiCkEiBeC_xHqqkZx_
	m_dwId = DWORD(-1);
} // CFCDlgModelessBase::CFCDlgModelessBase.

void CFCDlgModelessBase::DoDataExchange (CDataExchange* pDX)
{
	BASE_CLASS::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFCDlgModelessBase)
		// _xZkqqHx_iDiBiDiC_xHqqkZx_ - ClassWizard _xZkqqHx_iCmNiClBiCmMiImKjChFiCmJiDhNiDgCiDhDiDjDiDePjHhAiCmMiDhNiDeOiDiNiCpAjCmHiJmBiCnMiClNiCmNiNoNiPjMiClFiCnMiClHiBeC_xHqqkZx_
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CFCDlgModelessBase, BASE_CLASS)
	//{{AFX_MSG_MAP(CFCDlgModelessBase)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// 05.11.13 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	ON_WM_CREATE()

/////////////////////////////////////////////////////////////////////////////
// CFCDlgModelessBase _xZkqqHx_iDiGiBfLiDfFiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::SetWindowVisible
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiMiDfHiDfIiDgHiDiKiCmMjCgMiCmJiPfNiCmBiCmEiDeFiDeCiDjDiDgIiDeFiCmMjFfMiOkGiBeFjEpBjFfMiOkGiCpAjAnIiCoIjBnGiCkGiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	SetWindowVisible(BOOL)_xZkqqHx_iCmNiMmEiCnBiPgPiClFiOjOiCmJjFfMiOkGiPpDjBnEiCpAjAnNjCoIiCmFiCkLiCoJiCkKiBeB_xHqqkZx_
 *			_xZkqqHx_iClBiCmMiKnGjAjEiCmNiDiMiDfHiDfIiDgHiDiKiCmMjCgMiCmFjFfMiOkGiBeFjEpBjFfMiOkGiCpAjAnNjCoIiClHiCoJiClOiCkPiBeC_xHqqkZx_
 *			_xZkqqHx_jCmKiPoNiCmN_xHqqkZx_Create_xZkqqHx_iKnGjAjEiCmMiMoDiCmJiCfAiJpBiClOiCkPiOmAiNhDiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDlgModelessBase::SetWindowVisible ()
{
	ASSERT(m_dwId != DWORD(-1));
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iDeMiBfLjGlMiCpAiNoMjAkMiBeC_xHqqkZx_
//	WString wstrKey;
//	wstrKey.Format(L"%s\\CFCDlgModelessBase-%x", ::GetLocalAppName(), m_dwId);
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCmMjFfMiOkGiBeFjEpBjFfMiOkGiCpAiDiMiDfHiDfIiDgHiDiKiCkJiCoHjDmHiCnNiPgPiClHiBeC_xHqqkZx_
	BOOL bIsVisible = (BOOL)FFGetApp()->GetProfileIntW(GetRegKeyName(), L"Visible", int(FALSE));
	ShowWindow(bIsVisible ? SW_SHOW : SW_HIDE);
} // CFCDlgModelessBase::SetWindowVisible.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::GetRegKeyName
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iClBiCmMiDeFiDeCiDjDiDgIiDeFiMmFjHeMiCmMiDiMiDfHiDfIiDgHiDiKjDgPjIfOjGlMiCpAiOoGjDlOiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iDiMiDfHiDfIiDgHiDiKjDgPjIfOjGlMiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCmJjAnNjCoIiClDiCoKiClN_xHqqkZx_ID_xZkqqHx_iCpAiMlDiCmJiDiGiDgKiBfLiDeOiCmIjGlMjBePiCpAiNoMjAkMiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.22 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
WString CFCDlgModelessBase::GetRegKeyName () const
{
	ASSERT(m_dwId != DWORD(-1));
	// _xZkqqHx_iDeMiBfLjGlMiCpAiNoMjAkMiBeC_xHqqkZx_
	WString wstrKey;
	wstrKey.Format(L"%s\\CFCDlgModelessBase-%x", ::GetLocalAppName(), m_dwId);
	return wstrKey;
} // CFCDlgModelessBase::GetRegKeyName.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::SetWindowVisible
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCmMjFfMiOkGiBeFjEpBjFfMiOkGiCpAjAnIiCoIjBnGiCkGiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	bIsVisible	:_xZkqqHx_jFfMiOkGiPpDjBnEiCmJiClHiCoJiPoKiNiHiCmN_xHqqkZx_TRUE_xZkqqHx_iBeBjEpBjFfMiOkGiPpDjBnEiCmJiClHiCoJiPoKiNiHiCmN_xHqqkZx_
 *						 FALSE _xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_jFfMiOkGiPpDjBnEiCpAjFmPiNfIiClFiClNiMoDiBeBiDiMiDfHiDfIiDgHiDiKiCmJjFfMiOkGiBeFjEpBjFfMiOkGiPpDjBnEiCpAiLeMjIfOiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDlgModelessBase::SetWindowVisible (BOOL bIsVisible)
{
	ASSERT(m_dwId != DWORD(-1));
	if (::IsWindow(m_hWnd))
		ShowWindow(bIsVisible ? SW_SHOW : SW_HIDE);
	//----- _xZkqqHx_iDiMiDfHiDfIiDgHiDiKiCmJjCgMiCpAjAnNjCoI_xHqqkZx_ -----
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iDeMiBfLjGlMiCpAiNoMjAkMiBeC_xHqqkZx_
//	WString wstrKey;
//	wstrKey.Format(L"%s\\CFCDlgModelessBase-%x", ::GetLocalAppName(), m_dwId);
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCmMjFfMiOkGiBeFjEpBjFfMiOkGiCpAiDiMiDfHiDfIiDgHiDiKiCmJiLeMjIfOiBeC_xHqqkZx_
	FFGetApp()->WriteProfileIntW(GetRegKeyName(), L"Visible", int(bIsVisible));
} // CFCDlgModelessBase::SetWindowVisible.

/////////////////////////////////////////////////////////////////////////////
// CFCDlgModelessBase _xZkqqHx_iDeJiBfLiDgPiBfLiDiJiDeDiDgIiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::Create
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCpAiDiCiBfLiDgIiDiMiDfIiCmFiNoMjAkMiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	nIDTemplate	:_xZkqqHx_iDiKiDfMiBfLiDfIiDgFiDjDiDhGiDiMiBfLiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *			pParentWnd	:_xZkqqHx_jAgFiDeFiDeCiDjDiDgIiDeFiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jAkMiMpHiClFiClNiPoKiNiHiCmN_xHqqkZx_TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL CFCDlgModelessBase::Create (UINT nIDTemplate, CWnd* pParentWnd)
{
	// _xZkqqHx_iDfPiDeDiDeBiDiNiDePiCmM_xHqqkZx_ID_xZkqqHx_iBeCiDiMiDfHiDfIiDgHiDiKiCnGiCmMjFnLjBlGiCmJiOgHiCkEiBeC_xHqqkZx_
	m_dwId = nIDTemplate;
	// Baseclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	return BASE_CLASS::Create(nIDTemplate, pParentWnd);
} // CFCDlgModelessBase::Create.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::DoModal
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiCiBfLiDfPiDiLiDfPiDeDiDeBiDiNiDePiCpAjFfMiOkGiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iClBiCmMiKnGjAjEiCpAiOmAiNhDiClFiCmEiCmNiCkCiCkPiCmIiCkCiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
int CFCDlgModelessBase::DoModal ()
{
	FFThrowMiscUnknown();
	return FALSE;
} // CFCDlgModelessBase::DoModal.

/////////////////////////////////////////////////////////////////////////////
// CFCDlgModelessBase _xZkqqHx_iDiBiDgCiDfKiBfLiDfH_xHqqkZx_ _xZkqqHx_iDgOiDjDiDgIiDiJiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::OnDestroy
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeFiDeCiDjDiDgIiDeFiNoNiPjMiOjOiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.01.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDlgModelessBase::OnDestroy ()
{
	ASSERT(m_dwId != DWORD(-1));
	//----- _xZkqqHx_iDiMiDfHiDfIiDgHiDiKiCmJjCgMiCpAjAnNjCoI_xHqqkZx_ -----
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iDeMiBfLjGlMiCpAiNoMjAkMiBeC_xHqqkZx_
//	WString wstrKey;
//	wstrKey.Format(L"%s\\CFCDlgModelessBase-%x", ::GetLocalAppName(), m_dwId);
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCmMiImKjChFiCpAiDiMiDfHiDfIiDgHiDiKiCmJiLeMjIfOiBeC_xHqqkZx_
	CRect rtWindow;
	GetWindowRect(rtWindow);
	FFGetApp()->WriteProfileBinaryW(GetRegKeyName(), L"Rect", (LPBYTE)&rtWindow, sizeof(rtWindow));

	// Superclass_xZkqqHx_iKnGjAjEiBeC_xHqqkZx_
	BASE_CLASS::OnDestroy();
} // CFCDlgModelessBase::OnDestroy.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDlgModelessBase::OnInitDialog
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfPiDeDiDeBiDiNiDePiPiJiKpKiJlLiOjOiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDgHiDiNiBfLiDiLiCmJiDhEiDeIiBfLiDeKiDfIiCpAjAnNjCoIiClFiCmIiCkCiCmGiCkLiBeBjGnPiCoIjCgMiCmN_xHqqkZx_ TRUE _xZkqqHx_iCmGiCmIiCoIiCnMiClHiBeC_xHqqkZx_
 *			_xZkqqHx_jHoBiKeP_xHqqkZx_: OCX _xZkqqHx_iDhGiDiNiDhAiDgFiDeC_xHqqkZx_ _xZkqqHx_iDhJiBfLiDfHiCmMjGnPiCoIjCgMiCmN_xHqqkZx_ FALSE _xZkqqHx_iCmGiCmIiCoIiCnMiClH_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL CFCDlgModelessBase::OnInitDialog ()
{
	ASSERT(m_dwId != DWORD(-1));

	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	if (!BASE_CLASS::OnInitDialog())
		return FALSE;

	//----- _xZkqqHx_iDiMiDfHiDfIiDgHiDiKiCkJiCoHjCgMiCpAiOoGjDlO_xHqqkZx_ -----
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iDeMiBfLjGlMiCpAiNoMjAkMiBeC_xHqqkZx_
//	WString wstrKey;
//	wstrKey.Format(L"%s\\CFCDlgModelessBase-%x", ::GetLocalAppName(), m_dwId);
//----- 06.02.22 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCmMiImKjChFiCpAiDiMiDfHiDfIiDgHiDiKiCkJiCoHjDmHiCnNiPgPiClHiBeC_xHqqkZx_
	CRect* rtWindow;
	UINT uiDataSz;
	if (FFGetApp()->GetProfileBinaryW(GetRegKeyName(), L"Rect", (LPBYTE*)&rtWindow, &uiDataSz))
	//----- _xZkqqHx_iDiMiDfHiDfIiDgHiDiKiCkJiCoHiDeFiDeCiDjDiDgIiDeFiNmAjFfHiCkKjDmHiCnNiPgPiClJiClNiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiNmAjFfHiCpAiDiCiDgKiDfOiBfLiImKjChFiCmJjFoCjAlDiBeC_xHqqkZx_
		// _xZkqqHx_iDhNiDiLiDgAiDiCiDgKiDfOiBfLiKmCiLkLiCpAiNgMjHlGiBeC_xHqqkZx_
		*rtWindow += FFJustifyToMonitor(*rtWindow);
		// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCpAiInKjDkOiBeC_xHqqkZx_
		MoveWindow(*rtWindow);
		delete[] rtWindow;
	}

	return TRUE;
} // CFCDlgModelessBase::OnInitDialog.
