ATL Drawing 
Author Message
 ATL Drawing


I am using a device running HPC 2000, the device has a monchrome screen. I
am looking for a pice of code which caputers an image on a window given that
you have a window handle (m_hwnd) and saves the image to a bitmap file. I
used DIBSectionCE class wrapper from codeguru, but when i save the image it
gets stored with a black back-ground.

here is my code:

 HDC hScreenDC = ::GetDC(this->m_hWnd);
 HDC hmemDC = CreateCompatibleDC(hScreenDC);
 int ScreenWidth = GetDeviceCaps(hmemDC, HORZRES);
 int ScreenHeight = GetDeviceCaps(hmemDC, VERTRES);
 hmemBM = CreateCompatibleBitmap(hmemDC, ScreenWidth,  ScreenHeight);

 if ( GetDeviceCaps(hmemDC, RASTERCAPS) & RC_PALETTE){
  ::MessageBox(0, L"palette based display", bstrFileName, MB_OK);

 CDIBSectionCE dibsection;

 if(dibsection.SetBitmap(hmemBM, NULL)){

  ::MessageBox(0, L"About to save bitmap", bstrFileName, MB_OK);
   ::MessageBox(0, L"Failed to save", bstrFileName, MB_OK);
   return E_FAIL;


  return S_OK;

 ::MessageBox(0, L"Failed to set bitmap", bstrFileName, MB_OK);
 return E_FAIL;


Wed, 13 Jul 2005 06:01:45 GMT  
 [ 1 post ] 

 Relevant Pages 

1. ATL drawing for ce

2. Drawing Problem in ATL

3. ATL combobox - - drawing problem

4. Sample owner-draw radio button with ATL

5. ATL ActiveX composite Control and drawing

6. Need help with Owner Drawn Button Class in ATL composite Control

7. Help - Problems with Drawing an MFC ActiveX control inside on ATL compsoite control

8. Owner drawn listbox in ATL

9. Owner Draw in ATL/WTL Window Controls

10. Problems with Drawing an MFC ActiveX control inside on ATL compsoite control

11. ATL COM - Passing ATL COM classes through another ATL COM class in the same app

12. How to convert Drawing.Icon to Drawing.Image


Powered by phpBB® Forum Software