typedef Drm::TXValuePtr<Drm::utilities::ClBitmapDisplay> display_type; display_type m_Display; BOOL CZF::OnInitDialog() { CWnd *pWnd(GetDlgItem(IDC_IMAGE)); ASSERT(pWnd); display_type pDisplay(new ClBitmapDisplay(pWnd)); // //nofail operations m_Display.Swap(pDisplay); } calling of Display method is void CZF::DisplayBMP() { m_Display->Display(*m_pSrcBmpFolder); } void abc::RefreshLive(const BYTE* pImg) { try { HWND wnd=::GetDlgItem(m_hWnd, IDC_IMAGE); DRM_EXP_THROW_0(((NULL != wnd) && ::IsWindow(wnd)),Drm::CXSystemSpecificException); if(NULL != wnd && ::IsWindow(wnd)) { m_Display->Display(wnd, (BITMAPINFOHEADER*)(pImg)); } } catch(const exception& sex) { stringstream ss; /*ss<<"RefreshLive exception: "<<sex.what()<<endl; ::OutputDebugString(ss.str().c_str());*/ } } void ClBitmapDisplay::Display ( HWND hWnd, BITMAPINFOHEADER *pBI) { RECT stRect; // if ( !GetClientRect ( hWnd, &stRect ) ) { throw Drm::CXSystemSpecificException ( ); } // HDC hDC = GetDC ( hWnd ); SetStretchBltMode ( hDC, COLORONCOLOR ); // int nErr = StretchDIBits ( hDC , stRect.left , stRect.top , stRect.right - stRect.left , stRect.bottom - stRect.top , 0 , 0 , static_cast < int > ( pBI->biWidth ) , static_cast < int > ( pBI->biHeight ) , Drm::utilities::ClSimpleBitmap::Pixel ( pBI ) , reinterpret_cast < BITMAPINFO* > ( pBI ) , DIB_RGB_COLORS , SRCCOPY ); // ReleaseDC ( hWnd, hDC ); if ( GDI_ERROR == nErr ) { throw Drm::CXSystemSpecificException ( ); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)