Win32 DWMAPI DwmGetWindowAttribute failure
i'm developing VSTO add-in for outlook which includes overlay on top of the word window. I'm building my UI using WPF. Problem is that when i'm trying to attach WPF Window ( merge left/top/width/height ) to outlook window when STARTING application at scale more than 100% GetWindowsRect Returns wrong rectangle. BUT when i'm starting application at 100% scale then change windows scale at runtime to whatever value everything is good and DPI Aware. Both cases ( starting and runtime ) GetDpiForWindow returns correct values which is...strange. DPI Awareness is set using SetThreadDpiAwareness when forms are created.
After countless attempts i decided to try DwmGetWindowAttribute which also fails with hresult 0x80070006 (invalid handle). Strange thing is that DwmGetWindowAttribute works perfectly for root outlook window but fails to child one ( _WwG to be precise )
DwmGetWindowAttribute docs don't say anything about it. Feels like some windows bug. Any advices will be appreciated.