public static SHFILEINFO GetFileInfoFromLocation(string FileLocation, SHGFIFlags Flags) { var shinfo = new SHFILEINFO(); SHGetFileInfo(FileLocation, (uint)FlagsAndAttributes.NORMAL, ref shinfo, (uint)Marshal.SizeOf(shinfo), (uint)Flags); return(shinfo); }
public static SHFILEINFO GetFileInfoFromExtension(string FileExtension, SHGFIFlags Flags) { FileExtension = "*" + FileExtension; var shinfo = new SHFILEINFO(); SHGetFileInfo(FileExtension, (uint)FlagsAndAttributes.NORMAL, ref shinfo, (uint)Marshal.SizeOf(shinfo), (uint)Flags | (uint)SHGFIFlags.SHGFI_USEFILEATTRIBUTES); return(shinfo); }
public static BitmapSource GetFileExtensionIcon(SHGFIFlags flags = SHGFIFlags.Icon | SHGFIFlags.UseFileAttributes) { SHFILEINFO shfi = new SHFILEINFO(); IntPtr icon = SHGetFileInfo(@"C:\Windows", FileAttributeDirectory, ref shfi, (uint)Marshal.SizeOf <SHFILEINFO>(), flags); var bitmapSource = Imaging.CreateBitmapSourceFromHIcon(icon, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DestroyIcon(icon); return(bitmapSource); }
public static SHFILEINFO GetFileInfoFromLocation(string FileLocation, SHGFIFlags Flags) { var shinfo = new SHFILEINFO(); SHGetFileInfo(FileLocation, (uint)FlagsAndAttributes.NORMAL, ref shinfo, (uint)Marshal.SizeOf(shinfo), (uint)Flags); return shinfo; }
public static SHFILEINFO GetFileInfoFromExtension(string FileExtension, SHGFIFlags Flags) { FileExtension = "*" + FileExtension; var shinfo = new SHFILEINFO(); SHGetFileInfo(FileExtension, (uint)FlagsAndAttributes.NORMAL, ref shinfo, (uint)Marshal.SizeOf(shinfo), (uint)Flags | (uint)SHGFIFlags.SHGFI_USEFILEATTRIBUTES); return shinfo; }
public static extern IntPtr SHGetFileInfo( IntPtr pszPath, SFGAOFlags dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, SHGFIFlags uFlags );
private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbFileInfo, SHGFIFlags uFlags);