Closed deepakakkil001 closed 3 years ago
Hmmm, I haven't heard reports of this yet. After you've set AllowTransparenacy
on the window, could you call GetWindowDisplayAffinity
and see if it returns what you would expect?
Additionally, could you share what build of windows you're running?
I am running Windows Build 19041. I set the AllowTransparency for the WPF window in XAML and the calling GetWindowDisplayAffinity() once the window is loaded returns a display affinity setting of 0 (WDA_NONE), as expected.
It seems when i next call SetWindowDisplayAffinity() , it fails with a win32 error code of 8 [Not enough storage is available to process this command]. The error disappears when i set AllowTransparency back to false. I can recreate the behaviour on my computer with a minimal WPF project that only calls the SetWindowDisplayAffinity on loaded event.
Thanks for the info! I'm able to reproduce the issue and we're investigating internally.
Hello, Any updates on this one? Thanks
Sorry, we don't have updates at this time. We still have the bug open and have identified the problem area in the code, we just haven't gotten to it yet.
Sorry, I forgot to update this after our investigation. The issue is that WPF internally uses UpdateLayeredWindow
in this scenario, which conflicts with the ability to call SetWindowDisplayAffinity
. For the time being, this is by design. However, we may revise this in the future. Closing this issue for now.
Sorry, I forgot to update this after our investigation. The issue is that WPF internally uses
UpdateLayeredWindow
in this scenario, which conflicts with the ability to callSetWindowDisplayAffinity
. For the time being, this is by design. However, we may revise this in the future. Closing this issue for now.
Can you add more details? Why does it conflict? And most importantly, is there any hack for it?
Unfortunately I can't go into further detail, and I don't have a workaround at the moment. But it just to happens I'll be looking at this again soon, and I'll update you on any workarounds I find or if we fix this issue.
I am starting from the ScreenCapture WPF sample, and trying to implement a feature that will allow screen capture of the full display excluding the WPF window that i have. I am using the SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE) in the WPF window to skip the window from screen capture (since i want to skip the window completely, instead of having the black region).
In a regular WPF Window, the approach works fine and I am able to capture the screen skipping the WPF window. However, when the WPF window has AllowTransparenacy enabled, the SetWindowDisplayAffinity returns 0 and the screencapture retains the WPF window.
Is this a known issue? Is there a way to work around this, i.e. to skip a semi transparent WPF window that the application owns from the screen capture?
Thanks in advance,