Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 public static extern IntPtr SHGetFileInfo(
     IntPtr pszPath,
     SFGAOFlags dwFileAttributes,
     ref SHFILEINFO psfi,
     uint cbSizeFileInfo, 
     SHGFIFlags uFlags
 );
Ejemplo n.º 7
0
 private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbFileInfo, SHGFIFlags uFlags);