Thread: SetLayeredWindowAttributes issue

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    7

    SetLayeredWindowAttributes issue

    I have created a window that is partially transparent

    using a call to
    SetLayeredWindowAttributes

    if I pass LWA_COLORKEY into it, as in

    SetLayeredWindowAttributes(Self.Handle, clWhite, ALPHA_VALUE, LWA_COLORKEY);

    then everything that is white is completely transparent

    if I pass the LWA_Alpha into it as in

    etLayeredWindowAttributes(Self.Handle, clWhite, 128, LWA_Alpha);

    then everything is 50% transparent

    if I pass both parameters in as in

    SetLayeredWindowAttributes(Self.Handle, clWhite, ALPHA_VALUE, LWA_Alpha or LWA_COLORKEY);

    then all the white areas are transparent, and everything else is 50%

    is there a way to get only the white area to be 50% transparent, and everything else to be 100% visible

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It doesn't appear from the documentation that you can achieve that. I doubt that the hardware would have any trouble achieving that, but it just so happens that MS didn't allow you to choose those options.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    7
    hmmm thats a bit of a bummer.... :-\

    I wonder if there is another way to do it-you will be able to create very nice interfaces if you could- like having a mp3 player where all the controls are opaque and just where the graphic equalizers are, they on a semi- transparent surface, like they are playing over glass

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by ave View Post
    hmmm thats a bit of a bummer.... :-\

    I wonder if there is another way to do it-you will be able to create very nice interfaces if you could- like having a mp3 player where all the controls are opaque and just where the graphic equalizers are, they on a semi- transparent surface, like they are playing over glass
    Well, you could draw those surfaces with alphablended blits, I suppose.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    290
    You can make very fancy shaped windows with per-pixel alpha using the layered window API. Look into UpdateLayeredWindow(). Keep in mind, this isn't exactly simple.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. float calculation issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-26-2008, 04:56 AM
  2. re-entrancy pattern issue setbacks
    By George2 in forum Windows Programming
    Replies: 0
    Last Post: 04-12-2008, 02:23 AM
  3. type safe issue
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 02-12-2008, 09:32 PM
  4. directsound issue
    By valis in forum Tech Board
    Replies: 0
    Last Post: 06-25-2006, 09:28 PM
  5. my first issue of GDM
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-12-2002, 04:02 PM