// $PROJECT$ application.
// Copyright (c) $YEAR$ by $AUTHOR$,
// All rights reserved.

// $PROJECT$App.cpp - implementation of the C$PROJECT$App class

// initially generated by $GENERATOR$ on $DATE$ at $TIME$
// visit http://zarezky.spb.ru/projects/afx_scratch.html for more info

//////////////////////////////////////////////////////////////////////////////////////////////
// PCH includes

#include "stdafx.h"

//////////////////////////////////////////////////////////////////////////////////////////////
// resource includes

#include "Resource.h"

//////////////////////////////////////////////////////////////////////////////////////////////
// other includes

#include "$PROJECT$App.h"
#include "MainFrame.h"

//////////////////////////////////////////////////////////////////////////////////////////////
// debugging support

#if defined(_DEBUG)
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif   // _DEBUG

//////////////////////////////////////////////////////////////////////////////////////////////
// object model

IMPLEMENT_DYNAMIC(C$PROJECT$App, CWinApp)

//////////////////////////////////////////////////////////////////////////////////////////////
// message map

BEGIN_MESSAGE_MAP(C$PROJECT$App, CWinApp)
END_MESSAGE_MAP()

//////////////////////////////////////////////////////////////////////////////////////////////
// construction/destruction

C$PROJECT$App::C$PROJECT$App(void)
{
}

C$PROJECT$App::~C$PROJECT$App(void)
{
}

//////////////////////////////////////////////////////////////////////////////////////////////
// overridables

BOOL C$PROJECT$App::InitInstance(void)
{
	CMainFrame* pMainFrame = new CMainFrame();
	if (pMainFrame != NULL)
	{
		// try to create and show main window
		if (pMainFrame->Create(NULL, AfxGetAppName()))
		{
			ASSERT(::IsWindow(pMainFrame->GetSafeHwnd()));
			pMainFrame->SetIcon(LoadIcon(IDI_APP_ICON), TRUE);
			pMainFrame->SetIcon(LoadSmIcon(MAKEINTRESOURCE(IDI_APP_ICON)), FALSE);
			pMainFrame->ShowWindow(m_nCmdShow);
			pMainFrame->UpdateWindow();
			m_pMainWnd = pMainFrame;

			// succeeded
			return (TRUE);
		}
	}

	// failed to create main window
	return (FALSE);
}

//////////////////////////////////////////////////////////////////////////////////////////////
// diagnostic services

#if defined(_DEBUG)

void C$PROJECT$App::AssertValid(void) const
{
	// first perform inherited validity check...
	CWinApp::AssertValid();

	// ...and then verify our own state as well
}

void C$PROJECT$App::Dump(CDumpContext& dumpCtx) const
{
	try
	{
		// first invoke inherited dumper...
		CWinApp::Dump(dumpCtx);

		// ...and then dump own unique members
	}
	catch (CFileException* pXcpt)
	{
		pXcpt->ReportError();
		pXcpt->Delete();
	}
}

#endif   // _DEBUG

//////////////////////////////////////////////////////////////////////////////////////////////
// implementation helpers

HICON C$PROJECT$App::LoadSmIcon(LPCTSTR pszResName)
{
	HINSTANCE hInstRes = AfxGetResourceHandle();
	int cxSmIcon = ::GetSystemMetrics(SM_CXSMICON);
	int cySmIcon = ::GetSystemMetrics(SM_CYSMICON);
	HANDLE hSmIcon = ::LoadImage(hInstRes, pszResName, IMAGE_ICON, cxSmIcon, cySmIcon, 0);
	return (static_cast<HICON>(hSmIcon));
}

// the one and only application object

static C$PROJECT$App g_app$PROJECT$;

// end of file
