Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, thank you everyone! But I think I found my own solution!</p> <p>I handle the Messages: WM_DWMCOMPOSITIONCHANGED (0x031E) &amp; WM_THEMECHANGED (0x031A)</p> <p>and on catching one of those messages I simply assign the glass again or a new background depending on DwmIsCompositionEnabled().</p> <p>Actually I have something similar to the following:</p> <pre><code>const int WM_THEMECHANGED = 0x031A; const int WM_DWMCOMPOSITIONCHANGED = 0x031E; private static void ApplyTheme(IntPtr hwnd) { if (DwmIsCompositionEnabled()) { HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent; MARGINS margins = new MARGINS(new Thickness(-1)); DwmExtendFrameIntoClientArea(hwnd, ref margins); } else { HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = SystemColors.ActiveCaptionBrush.Color; } } private static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == WM_THEMECHANGED) { ApplyTheme(hwnd); } if (msg == WM_DWMCOMPOSITIONCHANGED) { ApplyTheme(hwnd); } return IntPtr.Zero; } </code></pre> <p>I get the hwnd.</p> <p>I hook it.</p> <pre><code>HwndSource.FromHwnd(hwnd).AddHook(new HwndSourceHook(WndProc)); </code></pre> <p>I make the WPF Window Background transparent, because later, in the WndProc function I will only be able to access my hwnd Background (Win32).</p> <pre><code>window.Background = Brushes.Transparent; </code></pre> <p>And now I only have to assign the style for the first time:</p> <pre><code>ApplyTheme(hwnd); </code></pre> <p>Thats it! Works perfectly for me (Win 64 Home Premium) after I disable or enable aero, switch between different aero or non-aero styles or hibernate, so it is exactly, what I was looking for. Thank you, for your great ideas!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload