1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Runtime.InteropServices;
- using System.Runtime.InteropServices.ComTypes;
- namespace IMAPI2.MediaItem
- {
- [StructLayout(LayoutKind.Sequential)]
- public struct SHFILEINFO
- {
- public IntPtr hIcon;
- public IntPtr iIcon;
- public uint dwAttributes;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
- public string szDisplayName;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
- public string szTypeName;
- };
- class Win32
- {
- public const uint SHGFI_ICON = 0x100;
- public const uint SHGFI_LARGEICON = 0x0; // Large icon
- public const uint SHGFI_SMALLICON = 0x1; // Small icon
- [DllImport("shell32.dll")]
- public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
- [DllImport("user32.dll")]
- public static extern bool DestroyIcon(IntPtr handle);
- public const uint FILE_ATTRIBUTE_NORMAL = 0x00000080;
- public const uint STGM_DELETEONRELEASE = 0x04000000;
- public const uint STGM_SHARE_DENY_WRITE = 0x00000020;
- public const uint STGM_SHARE_DENY_NONE = 0x00000040;
- public const uint STGM_READ = 0x00000000;
- [DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = false, EntryPoint = "SHCreateStreamOnFileW")]
- public static extern void SHCreateStreamOnFile(string fileName, uint mode, ref IStream stream);
- }
- }
|