Thread: Invisible window

  1. #1
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154

    Invisible window

    How do i make my window see-through, i want to display a bmp inside the window, then make it invisible so just the bmp is left, i tried using
    Code:
    wc.hbrBackground = HBRUSH(0);
    but the 'inivisble' part never repaints.

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I'm not sure exactly what you mean, but I've done something similar before.

    I gave my window the WS_POPUPWINDOW (or was it WS_POPUP) style, to remove the caption. Then I made the size of the window's client area so that it was the exact same size as the bitmap.

    Then in the WM_PAINT notification, I BitBlt()ed my bitmap onto the window.

    Erm...did that make sense? =P

    P.S. my bitmap was rectangular. if your's is irregular, you might want to take a look at window regions

  3. #3
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    yea thats basicly what im doing, just i need to get rid of the grey parts seeing as my bmp isnt perfectly rectangular

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I see, then perhaps you should consider Window Regions.
    Because setting a null(0) to a window's background brush doesn't make it invisible.

    Here's a relatively good tutorial on the topic:
    http://www.flipcode.com/articles/art...n32skins.shtml

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    To set your background invisible. Then in your windows class use:

    hbrbackground = (HBRUSH) GetStockObject (HOLLOW_BRUSH);

    I think thats right im not sure.

  6. #6
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    exactly the same effect as HBRUSH(0);

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    have you looked at

    WS_EX_TRANSPARENT
    "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

  8. #8
    Registered User
    Join Date
    Oct 2003
    Posts
    4
    Try painting the window a color that isnt included in your image. Then make that color transparent, that way your image shows up and all the areas that showed up around it because of the image being irregular will be transparent. At least in theory.

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, 11:06 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM