The MARGINS parameter to the DwmExtendFrameIntoClientArea function controls how far the frame extends into the client area


A customer wrote a program that calls Dwm­Extend­Frame­Into­Client­Area to extend the frame over the entire client area, but then discovered that this made programming difficult:

I have a window which I want to have a glassy border but an opaque body. I made my entire window transparent by calling Dwm­Extend­Frame­Into­Client­Area, and I understand that this means that I am now responsible for managing the alpha channel when drawing so that the body of my window remains opaque while the glassy border is transparent. Since most GDI functions are not alpha-aware, this management is frustrating. Is there a better way? In pictures, I only want the red portion of the diagram below to be on glass; the inside yellow part should be opaque like normal. Is there an API that can do this?

This customer's excitement about the glass frame is like somebody who buys a pallet of tangerine juice even though he only wanted two glasses. And now he has questions about how to store the rest of the tangerine juice he didn't want.

This customer, it appears, passed −1 as the MARGINS to Dwm­Extend­Frame­Into­Client­Area which means "Bring it on, baby! Give me all tangerine all the time everywhere!" If you only want the glass to extend into part of your client area, then say so. Set the MARGINS to the thickness of the glass border (the thickness of the red portion of the above diagram).

Comments (8)
  1. Dan Bugglin says:

    Yeah this article confused me at first because I know what that API does… and I assumed the customer did too since he was using it.  Clearly I don't have what it takes to do tech support.  Which is fine by me.

  2. Jeff says:

    I'm pretty sure it should be "pallet" – took me two reads to figure out the example was not about painting –

    [Fixed, thanks. -Raymond]
  3. Alexandre says:

    @Jeff: Well, it is about painting in a sense

  4. Ivo says:

    If you use -1 for the margins you get one clear piece of glass. With regular margins there is a bright line about 25% from the top. Depending on your needs that may or may not be a problem. For example if you want to extend the glass on the left side and put some text or graphics there, you will get a line right in the middle of your stuff.

  5. Jeff says:

    I am trying to imagine the situation where someone would actually say "Bring it on, baby! Give me all tangerine all the time everywhere!" Such a person would probably be quite entertaining. :)

  6. Anonymous says:

    Jeff: Entertaining maybe, but also covered in tangerine.

  7. Chris J says:

    @Anonymous — that might be their dream though.

  8. Gabe says:

    Well, in fairness to the poor programmer, the docs (msdn.microsoft.com/…/aa969512.aspx) *do* say "Use negative margin values to create the "sheet of glass" effect where the client area is rendered as a solid surface with no window border." which could be read as a command rather than simply one way to use the function. Much the way "Pack gel-filled bras in your checked baggage." could be read as a command rather than simply a way to transport certain types of bras. (blogs.msdn.com/…/705958.aspx)

Comments are closed.