-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathWinIcons.cs
72 lines (59 loc) · 2.56 KB
/
WinIcons.cs
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
This Code is published under the terms and conditions of the CC-BY-NC-ND-4.0
(https://creativecommons.org/licenses/by-nc-nd/4.0)
Please contribute to the current project.
SPDX-License-Identifier: CC-BY-NC-ND-4.0
@author: [email protected]
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Pdulvp.EasyFirewall
{
internal static class WinIcons
{
public const uint LVM_FIRST = 0x1000;
public const uint LVM_GETIMAGELIST = (LVM_FIRST + 2);
public const uint LVM_SETIMAGELIST = (LVM_FIRST + 3);
public const uint LVSIL_NORMAL = 0;
public const uint LVSIL_SMALL = 1;
public const uint LVSIL_STATE = 2;
public const uint LVSIL_GROUPHEADER = 3;
[DllImport("user32")]
public static extern IntPtr SendMessage(IntPtr hWnd,
uint msg,
uint wParam,
IntPtr lParam);
[DllImport("comctl32")]
public static extern bool ImageList_Destroy(IntPtr hImageList);
public const uint SHGFI_DISPLAYNAME = 0x200;
public const uint SHGFI_ICON = 0x100;
public const uint SHGFI_LARGEICON = 0x0;
public const uint SHGFI_SMALLICON = 0x1;
public const uint SHGFI_SYSICONINDEX = 0x4000;
[StructLayout(LayoutKind.Sequential)]
public struct SHFILEINFO
{
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260 /* MAX_PATH */)]
public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szTypeName;
};
[DllImport("shell32")]
public static extern IntPtr SHGetFileInfo(string pszPath,
uint dwFileAttributes,
ref SHFILEINFO psfi,
uint cbSizeFileInfo,
uint uFlags);
[DllImport("uxtheme", CharSet = CharSet.Unicode)]
public static extern int SetWindowTheme(IntPtr hWnd,
string pszSubAppName,
string pszSubIdList);
}
}