I want to enable desktop composition on a Windows 7 machine programmatically (preferrable C#) and already tried to do it with the infamous DwmEnableComposition
P/Invoke. However, this does not seem to work if DWM has never been enabled (and the performance test has not run). I can, however, enable DWM via the "Personalization" control panel w/o running the performance test.
My question therefore is: how can I do the same programmatically? And a second question: how can I achieve that a change in the setting is persistent (e. g. if I set DwmEnableComposition(false)
on a machine that has DWM enabled, it is re-enabled once the application exits)?