Files
wj32 7bd28e4357 moved branches, tags, trunk to 1.x branch
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2304 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2009-10-25 02:22:46 +00:00

28 lines
946 B
C#

using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace ProcessHacker
{
public static class ThemingScope
{
[DllImport("kernel32.dll")]
private static extern bool ActivateActCtx(IntPtr hActCtx, out IntPtr lpCookie);
public static void Activate()
{
IntPtr zero = IntPtr.Zero;
Assembly windowsForms = Assembly.GetAssembly(typeof(Control));
// HACK
IntPtr hActCtx = (IntPtr)windowsForms.GetType("System.Windows.Forms.UnsafeNativeMethods", true).
GetNestedType("ThemingScope", BindingFlags.NonPublic | BindingFlags.Static).
GetField("hActCtx", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
if (OSFeature.Feature.IsPresent(OSFeature.Themes))
ActivateActCtx(hActCtx, out zero);
}
}
}