There is no documented API for this. This is completely by design: this option is intended to be modified by the user, not by applications. And for this, the user can use the built-in applet: the Personalize control panel.
But, like the code you are referring to, there is an undocumented API that you can use - DwmSetColorizationParameters . You just need to thoroughly test that your code works on all target operating systems, and keep in mind that it can be broken with any new versions of Windows and / or any updates for the current version of Windows.
I know that it worked in Windows 7, but I did not test it with all the latest service packs and other updates, and I do not know if it works in Windows 8. Test all this for you. Using undocumented APIs is a lot of work.
Lucky you. Someone else has already done the reverse engineering for you. (And probably other people, too, like the one who wrote the code that you show in your question. It would be nice to give them credit. Maybe it was this guy ?)
Here's how you use it:
using System; using System.Drawing; using System.Globalization; using System.Runtime.InteropServices; class DwmManager { private struct DWM_COLORIZATION_PARAMS { public uint clrColor; public uint clrAfterGlow; public uint nIntensity; public uint clrAfterGlowBalance; public uint clrBlurBalance; public uint clrGlassReflectionIntensity; public bool fOpaque; } [DllImport("dwmapi.dll", EntryPoint = "#127", PreserveSig = false)] private static extern void DwmGetColorizationParameters(out DWM_COLORIZATION_PARAMS parameters); [DllImport("dwmapi.dll", EntryPoint = "#131", PreserveSig = false)] private static extern void DwmSetColorizationParameters(ref DWM_COLORIZATION_PARAMS parameters, bool unknown);
Once you have added this class to your project, you interact with it through the ColorizationColor property. Like comments, the DWM_COLORIZATION_PARAMS structure gives you much more information. You can add properties to get / set each of these additional parameters if you wish. Although, some experimentation will be required to determine what they are doing.
Note that you also need to verify that the DWM composition is supported and enabled by the host operating system before running any of these functions. (Otherwise, the PreserveSig attribute will throw an exception). This is pretty obvious, but worth mentioning anyway. For this you will also need this function:
[DllImport("dwmapi.dll")] private static extern int DwmIsCompositionEnabled(ref bool pfEnabled);