how to get hdc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • diwakar09
    New Member
    • Sep 2007
    • 39

    how to get hdc

    here is the code, i am using vc++
    Code:
    hbm = LoadImage(NULL,"msdn.bmp",IMAGE_BITMAP,80,40,LR_LOADFROMFILE);
    		
    /*		hdcSrc = GetDC((HWND)hbm);*/
    BitBlt(hdc, 0, 0, 80, 40, hdcSrc, 0, 0, SRCCOPY);
    i am having the handle to the image but for BitBlt i have to use hdc for this image
    GetDC() is only use for handle to the window, i want something simillar to this.
    pls. tell me how to solve this problem
  • Cucumber
    New Member
    • Sep 2007
    • 90

    #2
    Originally posted by diwakar09
    here is the code, i am using vc++
    Code:
    hbm = LoadImage(NULL,"msdn.bmp",IMAGE_BITMAP,80,40,LR_LOADFROMFILE);
    		
    /*		hdcSrc = GetDC((HWND)hbm);*/
    BitBlt(hdc, 0, 0, 80, 40, hdcSrc, 0, 0, SRCCOPY);
    i am having the handle to the image but for BitBlt i have to use hdc for this image
    GetDC() is only use for handle to the window, i want something simillar to this.
    pls. tell me how to solve this problem
    Get the DC of the window using GetDC( )
    Then create a compatible DC using CreateCompatibl eDC ( )
    Bind the bitmap with the compatible DC using SelectObject ( )
    Finally you can Bit Blit between both DCs

    Comment

    • diwakar09
      New Member
      • Sep 2007
      • 39

      #3
      Originally posted by Cucumber
      Get the DC of the window using GetDC( )
      Then create a compatible DC using CreateCompatibl eDC ( )
      Bind the bitmap with the compatible DC using SelectObject ( )
      Finally you can Bit Blit between both DCs

      thanx a lot for helping me

      Comment

      Working...