using System.Runtime.InteropServices;
namespace Pilz.Win32.Native;
public class Shell32
{
///
/// Creates an array of handles to large or small icons extracted from
/// the specified executable file, dynamic-link library (DLL), or icon
/// file.
///
///
/// Name of an executable file, DLL, or icon file from which icons will
/// be extracted.
///
///
///
/// Specifies the zero-based index of the first icon to extract. For
/// example, if this value is zero, the function extracts the first
/// icon in the specified file.
///
///
/// If this value is �1 and and
/// are both NULL, the function returns
/// the total number of icons in the specified file. If the file is an
/// executable file or DLL, the return value is the number of
/// RT_GROUP_ICON resources. If the file is an .ico file, the return
/// value is 1.
///
///
/// Windows 95/98/Me, Windows NT 4.0 and later: If this value is a
/// negative number and either or
/// is not NULL, the function begins by
/// extracting the icon whose resource identifier is equal to the
/// absolute value of . For example, use -3
/// to extract the icon whose resource identifier is 3.
///
///
///
/// An array of icon handles that receives handles to the large icons
/// extracted from the file. If this parameter is NULL, no large icons
/// are extracted from the file.
///
///
/// An array of icon handles that receives handles to the small icons
/// extracted from the file. If this parameter is NULL, no small icons
/// are extracted from the file.
///
///
/// Specifies the number of icons to extract from the file.
///
///
/// If the parameter is -1, the
/// parameter is NULL, and the
/// parameter is NULL, then the return
/// value is the number of icons contained in the specified file.
/// Otherwise, the return value is the number of icons successfully
/// extracted from the file.
///
[DllImport("Shell32", CharSet = CharSet.Auto)]
public static extern int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)] string lpszFile, int nIconIndex, nint[] phIconLarge, nint[] phIconSmall, int nIcons);
[DllImport("shell32.dll")]
public static extern nint SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
}