Processing Bitmap Data (part deux)

This is a discussion on Processing Bitmap Data (part deux) within the Windows Programming forums, part of the Platform Specific Boards category; <<< split http://cboard.cprogramming.com/windo...tmap-data.html >>> I'm trying to use this example to do some very similar task, but not on bitmap ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    2

    Processing Bitmap Data (part deux)

    <<< split Processing Bitmap Data >>>

    I'm trying to use this example to do some very similar task, but not on bitmap loaded from file but on screenshot. It seams that whole dBitmap is black.

    This is the code

    Code:
     
       hdc = GetDC(hWnd);
       GetWindowRect(hWnd, &rcClient);
       dBitmap = CreateCompatibleBitmap(hdc,rcClient.right-rcClient.left, rcClient.bottom-rcClient.top);
       if(!dBitmap)
            MessageBox(hWnd, L"CreateCompatibleBitmap Failed",L"Failed", MB_OK);
       
       pixels = GetBitmapPixels(dBitmap, hdc);
       GetObject(dBitmap, sizeof(BITMAP), &bmp);
    any suggestions?
    Last edited by bartus0; 12-09-2010 at 08:48 AM.

  2. #2
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    It's black because you don't actually write any data to the bitmap. You need to BitBlt (or equivalent) to fill it with an image. Here's a complete sample that captures the desktop, just modify the captured rect and stick it in your program.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    2
    Thank you for saving me a lot of time

    I knew there were some steps missing, just couldn't grasp the whole concept. New day fresh mind and it seams so easy now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Joining 2 data (bytes) array
    By susinaga in forum C Programming
    Replies: 3
    Last Post: 08-04-2010, 10:04 AM
  2. Need help with Bitmap Display
    By The Brain in forum Windows Programming
    Replies: 7
    Last Post: 03-23-2009, 05:33 AM
  3. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  4. C Programming Question
    By TK in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 07-04-2002, 07:11 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21