mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-30 17:16:52 +13:00
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace SystemTrayMenu.DllImports
|
|
{
|
|
public static partial class NativeMethods
|
|
{
|
|
private const int maxPath = 256;
|
|
|
|
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
|
|
private static extern IntPtr SHGetFileInfo(
|
|
string pszPath,
|
|
uint dwFileAttributes,
|
|
ref SHFILEINFO psfi,
|
|
uint cbFileInfo,
|
|
uint uFlags
|
|
);
|
|
|
|
internal static IntPtr Shell32SHGetFileInfo(
|
|
string pszPath,
|
|
uint dwFileAttributes,
|
|
ref SHFILEINFO psfi,
|
|
uint cbFileInfo,
|
|
uint uFlags
|
|
)
|
|
{
|
|
return SHGetFileInfo(pszPath,
|
|
dwFileAttributes,
|
|
ref psfi,
|
|
cbFileInfo,
|
|
uFlags);
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal struct SHFILEINFO
|
|
{
|
|
public const int NAMESIZE = 80;
|
|
public IntPtr hIcon;
|
|
public int iIcon;
|
|
public uint dwAttributes;
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = maxPath)]
|
|
public string szDisplayName;
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NAMESIZE)]
|
|
public string szTypeName;
|
|
}
|
|
}
|
|
}
|
|
|
|
|