private static IntPtr getIconHandleFromFilePathWithFlags(
            string filepath, IconSizeEnum iconsize,
            ref Shell32.SHFILEINFO shinfo, int fileAttributeFlag, uint flags)
        {
            const int ILD_TRANSPARENT = 1;
            var       retval          = SHGetFileInfo(filepath, fileAttributeFlag, ref shinfo, Marshal.SizeOf(shinfo), flags);

            if (retval == 0)
            {
                throw (new System.IO.FileNotFoundException());
            }
            var iconIndex      = shinfo.iIcon;
            var iImageListGuid = new Guid("46EB5926-582E-4017-9FDF-E8998DAA0950");

            Shell32.IImageList iml;
            var hres  = SHGetImageList((int)iconsize, ref iImageListGuid, out iml);
            var hIcon = IntPtr.Zero;

            hres = iml.GetIcon(iconIndex, ILD_TRANSPARENT, ref hIcon);
            return(hIcon);
        }
 public static extern int SHGetFileInfo(
     string pszPath,
     int dwFileAttributes,
     ref Shell32.SHFILEINFO psfi,
     int cbFileInfo,
     uint uFlags);