Files
dmex b02427417c PH1.x: fixed build
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2014-02-25 23:14:38 +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);
}
}
}