Skip to main content

 none
Window rectangle control RRS feed

  • Question

  • I have a window with custom frame (basically, I tell DefWindowProc to take a hike and I draw everything myself - titlebar, window shadow, the works). It has resizing regions outside of the visible window (kind of the way Windows 10 does now, though I'm currently developing on Windows 7), which is achieved by having multiple child windows along the border, with WS_EX_TRANSPARENT style. The window shadow is also drawn there.

    The problem i'm facing is the following: I can't find a way to tell the Window Manager that some parts of my window are decorative (the shadow) and should neither receive clicks, nor count toward the size of the window, and that some parts are for resizing only (and should probably not count toward the size of the window in some circumstances). Because of that the window interacts with the Window Manager badly: when it's resized to its maximal height (as specified in WM_GETMINMAXINFO), it actually looks smaller, because some space is occupied by the window shadow and resize areas. I also can't align the window along the top edge of the screen by dragging it, as Aero Snap promptly moves it back, because the window is larger (to WM) than it looks to the user.

    Is there a way to communicate to the WM that some parts of the window are decorative and should not be counted towards its size?

    Are there tricks to do the same thing differently - for example, instead of using multiple child windows use multiple top-level windows? That would allow border windows to be layered, which might help in making them input-transparent in some places, and the main window would remain small.

    Thursday, December 24, 2015 8:54 AM

All replies

  • Hi I_MID,

    >>Is there a way to communicate to the WM that some parts of the window are decorative and should not be counted towards its size?

    Personally I think the decorative part should always be counted into the size of the window, but we can manually disable that part to receive the click actions, EnableWindow seems to be a approach, we can disable the shadow to receive any mouse or keyboard input.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 28, 2015 4:56 AM
  • >>>>Is there a way to communicate to the WM that some parts of the window are decorative and should not be counted towards its size?

    >>Personally I think the decorative part should always be counted into the size of the window, but we can manually disable that part to receive the click actions, EnableWindow seems to be a approach, we can disable the shadow to receive any mouse or keyboard input.

    I'm not sure EnableWindow is going to help (although it's would improve some input aspects of the problem; I'll see if I can make some use of it). I don't remember seeing anyone mentioning that you can make parts of a window be click-through by disabling (with EnableWindow) the child windows corresponding to these parts.

    Also, while you were considering your reply, I've been digging, and found how Windows WM does this trick - there's a separate toplevel window, SysShadow, where Windows WM draws a shadow for a given window. Then WM ensures that this shadow window is always positioned appropriately under the actual window. Because the shadow window is layered, it trivially gets transparency done, even on earlier versions of Windows, and because it has WS_EX_TRANSPARENT, it's also click-through; WS_EX_NOACTIVATE hides it from the taskbar and the alt-tab pager. But it's still in the window list for a process, there are tools that let you inspect it.

    So I would say that "the decorative part should always be counted into the size of the window" part is indeed your personal opinion, as MS, apparently, doesn't think so.

    Monday, December 28, 2015 10:42 AM