CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2006
    Posts
    28

    how to create 32bit color HBITMAP object

    Hi Everyone,

    I ran into a problem. I am creating a memory device context and a compatible bitmap object. It seems to be when I try to draw anything on it, it turns out to be black or white. I could not understand it. I pasted my code how I am creating the bitmap object.

    Any idea will be helpful.

    HDC hScreenDC = ::GetDC( NULL );

    // Create memory DC
    mDC = ::CreateCompatibleDC( hScreenDC );

    // Create bitmap compatible with screen device context
    mBitmap = ::CreateCompatibleBitmap( hScreenDC, 200, 200 );

    mOldBitmap = (HBITMAP)::SelectObject( mDC, mBitmap );

    Thanks in advance.

    Regards.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: how to create 32bit color HBITMAP object

    Post more code. You don't show anything at all on how you're drawing to your bitmap, nor how you're bliting it back to the dc.

  3. #3
    Join Date
    Nov 2007
    Posts
    613

    Re: how to create 32bit color HBITMAP object

    ::CreateCompatibleDC(NULL) will create a dc compatible with the screen.

    I don't understand why do you use CreateCompatibleBitmap if you state you need a 32 bit bitmap. Use CreateBitmap.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured