reproduce DWM technology
Hi,
As I understand, the DWM run as a full screen WPF application that “captures” the rendered output of each application and it redraw each of them. It sounds simple but probably I miss something. Is it possible to capture the output of running applications, convert it and manipulate it with vector transformations?
thank you.
I don't know enough to comment on the specific comparison to DWM. If you want the WPF application output to be live, you can create a VisualBrush and set VisualBrush.Visual to the root of the page you wish to display. If you’d like it to be static and be a snapshot, you can use a RenderTargetBitmap to create a bitmap from the page.
See Greg Schechter's blog for more on DWM.
Right, you can achieve most of the effects the DWM achieves -- within your own application's window. You can do this by using elements mapped to 3D planes. You cannot, however, do what the DWM does in terms of capturing
other windows in the system, even if they are windows owned by your application. Only the DWM has access to the images for all windows in the system.
- the DWM is unmanaged code. It therefore does not use WPF. It uses the lower-level MIL APIs, which incidentally are not public (at this stage).
What happens, is that when applications ask for a handle to the screen to draw on (as they would do directly in XP), they are now given a handle to a surface to draw on instead. That surface resides in memory. DWM has algorithms built in, so it knows when it has to update what it displays. When it does that, it gets the surface, as an image, and passes it along to MIL (along with the glass window frame resources). MIL takes all the peices (of all the windows, assembled as a tree, like in WPF) and assembles the picture, ready for the screen.
The similarities are that both DWM and WPF use MIL (which in turn uses DirectX). Also, whilst DWM does not use WPF data types, it uses types that are very similar.
Unfortunatley, if you want to manipulate the content on the screen, you can't use WPF for that. Even if you could get the data, you would get it as a bitmap (since GDI+ draws it), and that's sort of useless. The exceptions to this are WPF applications and DirectX applications. Because WPF apps are rendered with MIL anyway, they're directly attached on as part of the DWM visual tree.