1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| #include "StdAfx.h" #include "ZLoadBitmap.h"
ZBitmap::ZBitmap() : m_hBitmap(NULL) , m_FileName(_T("")) { } ZBitmap::ZBitmap(const char* pFileName) : m_hBitmap(NULL) , m_FileName(pFileName) { this->LoadBitmapTo(pFileName); } ZBitmap::~ZBitmap() { if (NULL != m_hBitmap) { ::DeleteObject(m_hBitmap); m_hBitmap = NULL; } } BOOL ZBitmap::LoadBitmapTo(const char* pFileName) { if (NULL != m_hBitmap) { ::DeleteObject(m_hBitmap); m_hBitmap = NULL; } m_hBitmap = (HBITMAP)LoadImage(NULL, pFileName, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE); if (NULL == m_hBitmap) { return FALSE; } return TRUE; } HBITMAP ZBitmap::GetHandle() { return m_hBitmap; }
|