views:

18

answers:

1

Is it possible to access the Desktop Composition Engine in Windows Vista from a winforms application? The DCE apparently involves applications rendering to DCE buffers instead of directly to the screen. Since a winforms app has no way of getting information about the monitor's refresh rate and scanline status (other than via DirectX), animation in a winforms app is subject to tearing effects. With DCE enabled, the tearing effects are lessened but still there (apparently the DCE can still grab a buffer that your app is halfway through writing to and render it to the screen, thereby producing the half-one-frame-half-of-the-next tearing effects).

Is there any way for my winforms app to communicate with the DCE and possible avoid rendering during buffer switchover times?

+1  A: 

Could you import the DWMAPI.DLL, call DwmGetCompositionTimingInfo, tear apart the DWM_TIMING_INFO struct and synch your app with whatever timing information you can discern?

Alternatively, you might be able to control it with DwmSetDxFrameDuration

Jacob G
This looks like exactly what I'm looking for. Have you ever encountered any C# samples that wrap this?
MusiGenesis
I have not. But this blog looks promising to either have examples or to have links to examples - http://blogs.msdn.com/greg_schechter/archive/tags/DWM/default.aspx
Jacob G