The answer is: You cannot do that.
Microsoft does not expose a programmatic way for programs to enable or disable desktop composition on the user's machine.
The reason they don't provide an API is that programs might use it.
In the past Microsoft trusted developers not to do the wrong thing. That has changed
Because programmers were trusted to do the right thing
DwmEnableComposition
is only for your application to temporarily disable DWM if you aren't compatible with composition. It cannot be used to turn on composition, when the user has already turned it off.
Any computer sold in the last 5 years is graphically capable of using composition, and Windows turns it on by default if its supported. The only reason it would be turned off is:
- the user turned it off
- another application is running that doesn't support composition
In either case: you should not (and therefor cannot) turn it on.
You cannot do that.