This repository was archived by the owner on Feb 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNativeMethods.cs
More file actions
45 lines (37 loc) · 1.59 KB
/
Copy pathNativeMethods.cs
File metadata and controls
45 lines (37 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace PowerCacheOffice
{
internal class NativeMethods
{
[DllImport("user32.dll")]
public static extern int RegisterHotKey(IntPtr HWnd, int ID, int MOD_KEY, Keys KEY);
[DllImport("user32.dll")]
public static extern int UnregisterHotKey(IntPtr HWnd, int ID);
[DllImport("dwmapi.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attribute, ref bool pvAttribute, uint cbAttribute);
public static readonly int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public static readonly int SW_RESTORE = 9;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct SHFILEINFO
{
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szTypeName;
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DestroyIcon(IntPtr handle);
[DllImport("User32.dll")]
public static extern int GetDpiForSystem();
}
}