mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
b02427417c
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
28 lines
946 B
C#
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);
|
|
}
|
|
}
|
|
}
|