예제 #1
0
BOOL CCustomToolBar::SetBackgroundBitmap(LPCTSTR pszResourceName, HINSTANCE hInstance)
{
	BOOL fResult = FALSE;

	// Free any background bitmap that was allocated.
	FreeBackground();

	// Load the new background bitmap.
	TRY
	{
		m_pBackground = new CBitmap;
		if (Util::LoadResourceBitmap(*m_pBackground, pszResourceName, m_pPalette, hInstance))
		{
			// Redraw the window.
			Invalidate();

			fResult = TRUE;
		}
	}
	END_TRY

	if (!fResult)
	{
		// Something failed, make sure everything is freed.
		FreeBackground();
	}

	return fResult;
}
예제 #2
0
void CCustomToolBar::FreeBitmaps(void)
{
	// Free any bitmap that was allocated.
	FreeBackground();

	// Free any bitmap that was allocated.
	if (m_pBitmap != NULL)
	{
		m_pBitmap->DeleteObject();
		delete m_pBitmap;
		m_pBitmap = NULL;
	}

	// Free any mask bitmap that was allocated.
	if (m_pBitmapMask != NULL)
	{
		m_pBitmapMask->DeleteObject();
		delete m_pBitmapMask;
		m_pBitmapMask = NULL;
	}

	// Free any ID array that was allocated.
	m_nBitmapIDCount = 0;
	if (m_pBitmapIDArray != NULL)
	{
		delete [] m_pBitmapIDArray;
		m_pBitmapIDArray = NULL;
	}
}
예제 #3
0
void FreeMainMenu(struct MainMenu** ppMenu)
{
   struct MainMenu* pMenu = *ppMenu;
   FreeBackground(&pMenu->m_pBackground);

   pMenu->m_pConfig = NULL;//Does not own

   free(*ppMenu);
   *ppMenu = NULL;
}