Thread: Processing Bitmap Data (part deux)

  1. #1
    Registered User
    Join Date
    Dec 2010

    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

       hdc = GetDC(hWnd);
       GetWindowRect(hWnd, &rcClient);
       dBitmap = CreateCompatibleBitmap(hdc,rcClient.right-rcClient.left,;
            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 09:48 AM.

  2. #2
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    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
    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
    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