#include "stdafx.h"
#include "imp_config.h"
#include "imp_configwindow.h"

CImpBlockConfig::CImpBlockConfig(IUnknown *pUnkOuter) : CBlockConfig(pUnkOuter), m_pWndDialog(NULL)
{
}

CImpBlockConfig::~CImpBlockConfig()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())
	
	if ( m_pWndDialog && m_pWndDialog->m_hWnd )
		m_pWndDialog->DestroyWindow();
	if ( m_pWndDialog )
		delete(m_pWndDialog);
}

STDMETHODIMP CImpBlockConfig::ShowConfig()
{

	AFX_MANAGE_STATE(AfxGetStaticModuleState())
									// volame vzdy, kdyz jsme v DLL
	if ( !m_pWndDialog )			// neni vytvorena instance
		m_pWndDialog = new CImpBlockConfigWindow(NULL, m_pUnkOuter);
	if ( !m_pWndDialog )			// instanci se nepodarilo vytvorit
		return E_OUTOFMEMORY;
	if ( !m_pWndDialog->m_hWnd )	// neni vytvoreno okno
		m_pWndDialog->Create(IDD_DIALOG1);
	// ukazeme okno
	m_pWndDialog->ShowWindow(SW_SHOW);
	return S_OK;
}

STDMETHODIMP CImpBlockConfig::RefreshData()
{
	return S_OK;
}