Exemplo n.º 1
0
 public static extern IntPtr SHGetFileInfo(
     string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
Exemplo n.º 2
0
 private BitmapSource LoadBitmapSource(FileSystemInfo info)
 {
     SHFILEINFO shinfo = new SHFILEINFO();
     var hImgLarge = Win32.SHGetFileInfo(info.FullName, 0,
         ref shinfo, (uint)Marshal.SizeOf(shinfo),
         Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
     BitmapSource source = Imaging.CreateBitmapSourceFromHIcon(shinfo.hIcon, Int32Rect.Empty, null);
     Win32.DestroyIcon(shinfo.hIcon);
     return source;
 }