/*
 *******************************************
 *    Copyright 1999, Autodesk, Inc.       *
 *                                         *
 *    All Rights Reserved.                 *
 *******************************************
 */

// resourcehelper.cpp
/////////////////////////////////////////////////////////

#ifdef _DEBUG
#ifndef _ARXDEBUG
#define _DEBUG_WAS_DEFINED
#undef _DEBUG
#endif //_ARXDEBUG
#endif //_DEBUG
#include "stdafx.h"           // MFC stuff
#ifdef _DEBUG_WAS_DEFINED
#define _DEBUG
#undef _DEBUG_WAS_DEFINED
#endif

#include "resourcehelper.h"

// Temporary Resource Override
HINSTANCE CTemporaryResourceOverride::m_hInstanceDefault = NULL;

void CTemporaryResourceOverride::SetDefaultResource(HINSTANCE hInstDefault)
{
  ASSERT(hInstDefault != NULL);
  m_hInstanceDefault = hInstDefault;
}

void CTemporaryResourceOverride::CommonConstruction(HINSTANCE hInst)
{
  m_hInstanceOld = AfxGetResourceHandle();
  AfxSetResourceHandle(hInst);
}

CTemporaryResourceOverride::CTemporaryResourceOverride(HINSTANCE hInstNew)
{
  ASSERT(hInstNew != NULL);
  CommonConstruction(hInstNew);
}

CTemporaryResourceOverride::CTemporaryResourceOverride()
{
  ASSERT(m_hInstanceDefault != NULL);
  CommonConstruction(m_hInstanceDefault);
}

CTemporaryResourceOverride::~CTemporaryResourceOverride()
{
  AfxSetResourceHandle(m_hInstanceOld);
}



