How to get byte array from HBITMAP object in win32 project?

Discussion in 'Win32' started by varsha123, Mar 3, 2010.

  1. varsha123

    varsha123 New Member

    Joined:
    Mar 3, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,


    In win32 DLL project, I want to capture desktop window
    into byte array. and display bitmap image using byte array.

    For that I have capture window function which returns HBITMAP object.
    then I saved this object into bit map file and for display purpose I
    load that image.

    Now, instead of BMP file I want to store capture data into byte array
    and for display bitmap image I want to use byte arrray.

    So I want convert HBITMAP object to byte array and byte array to
    HBITMAP object.

    In MFC activex I used Cbitmap same purpose but in win 32 Cbitmap not
    available.

    So, How to acheive this in win 32 DLL project.

    Thanks & Regards
    Varsha
     
  2. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0
    CBitmap is just a wrapper for some of the common GDI bitmap routines. You should still be able to call, say, ::GetBitmapBits() to extract a pointer to the byte data that make up the bitmap.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice