예제 #1
0
파일: ShellHelper.cs 프로젝트: kidaa/Pulse
 public static BitmapSource ExtractAssociatedIcon(string path, bool large)
 {
     ShellFileSystemInfo info = new ShellFileSystemInfo();
     NativeMethods.SHGetFileInfo(path, 0, ref info, Marshal.SizeOf(info), SHGetFileInfoFlags.Icon | (large ? SHGetFileInfoFlags.LargeIcon : SHGetFileInfoFlags.SmallIcon));
     using (Icon icon = Icon.FromHandle(info.IconHandle))
     using (Bitmap bitmap = icon.ToBitmap())
         return BitmapConverter.ToBitmapSource(bitmap);
 }
예제 #2
0
 public static extern IntPtr SHGetFileInfo(string path, uint attributes, ref ShellFileSystemInfo info, int fileInfoSize, SHGetFileInfoFlags flags);
예제 #3
0
 public static extern IntPtr SHGetFileInfo(string path, uint attributes, ref ShellFileSystemInfo info, int fileInfoSize, SHGetFileInfoFlags flags);