What's underneath my window?

This is a discussion on What's underneath my window? within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I'm trying to make a small window that creates an alpha effect over the area of the desktop that ...

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,255

    What's underneath my window?

    Hello,

    I'm trying to make a small window that creates an alpha effect over the area of the desktop that is present. To do this, I need to get the bitmap data of the desktop underneath the window. Does anyone know of a way I can capture the desktop image without my window being present on it?

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    If you window is not present how can it have an area underneath it?

    Use GetDC(NULL) for the whole screen Then create a compatible DC, bitmap and BitBlt the section you want on to it.

    Fill a BITMAPINFO then use GetDIBits to retrive info on the BMP, then use these values to again call GetDIBits and get the actual data.
    Convert from the current color depth and then try to display with your new colour depth. ie 16 bit (4bit for each colour, 4 unused or 5bit each colour 1 unused), 24 (bmp is array of RGBQUADs) or 32bit (1byte for each colour + 1 byte for blending and intensity)

    Remember some graphics cards may use differnet formats. And BMP's are BGR not RGB and are bottom to top. That is the last line is the top line of the image.
    Last edited by novacain; 04-28-2003 at 12:50 AM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 10:06 AM
  3. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM

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