93 lines
2.9 KiB
C#
93 lines
2.9 KiB
C#
using ShellExtensions.Interop.Common;
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
|
|
namespace ShellExtensions.Interop
|
|
{
|
|
internal static class HandlerNativeMethods
|
|
{
|
|
internal static readonly Guid IThumbnailProviderGuid = new Guid("e357fccd-a995-4576-b01f-234630154e96");
|
|
|
|
internal static readonly Guid IInitializeWithFileGuid = new Guid("b7d14566-0509-4cce-a71f-0a554233bd9b");
|
|
internal static readonly Guid IInitializeWithStreamGuid = new Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f");
|
|
//internal static readonly Guid IInitializeWithItemGuid = new Guid("7f73be3f-fb79-493c-a6c7-7ee14e245841");
|
|
|
|
internal static readonly Guid IMarshalGuid = new Guid("00000003-0000-0000-C000-000000000046");
|
|
}
|
|
|
|
#region Interfaces
|
|
|
|
/// <summary>
|
|
/// ComVisible interface for native IThumbnailProvider
|
|
/// </summary>
|
|
[ComImport]
|
|
[Guid("e357fccd-a995-4576-b01f-234630154e96")]
|
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
interface IThumbnailProvider
|
|
{
|
|
/// <summary>
|
|
/// Gets a pointer to a bitmap to display as a thumbnail
|
|
/// </summary>
|
|
/// <param name="squareLength"></param>
|
|
/// <param name="bitmapHandle"></param>
|
|
/// <param name="bitmapType"></param>
|
|
void GetThumbnail(uint squareLength, [Out] out IntPtr bitmapHandle, [Out] out uint bitmapType);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Provides means by which to initialize with a file.
|
|
/// </summary>
|
|
[ComImport]
|
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
[Guid("b7d14566-0509-4cce-a71f-0a554233bd9b")]
|
|
interface IInitializeWithFile
|
|
{
|
|
/// <summary>
|
|
/// Initializes with a file.
|
|
/// </summary>
|
|
/// <param name="filePath"></param>
|
|
/// <param name="fileMode"></param>
|
|
void Initialize([MarshalAs(UnmanagedType.LPWStr)] string filePath, AccessModes fileMode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Provides means by which to initialize with a stream.
|
|
/// </summary>
|
|
[ComImport]
|
|
[Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f")]
|
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
interface IInitializeWithStream
|
|
{
|
|
/// <summary>
|
|
/// Initializes with a stream.
|
|
/// </summary>
|
|
/// <param name="stream"></param>
|
|
/// <param name="fileMode"></param>
|
|
void Initialize(IStream stream, AccessModes fileMode);
|
|
}
|
|
|
|
#endregion
|
|
|
|
// <summary>
|
|
/// Thumbnail Alpha Types
|
|
/// </summary>
|
|
public enum ThumbnailAlphaType
|
|
{
|
|
/// <summary>
|
|
/// Let the system decide.
|
|
/// </summary>
|
|
Unknown = 0,
|
|
|
|
/// <summary>
|
|
/// No transparency
|
|
/// </summary>
|
|
NoAlphaChannel = 1,
|
|
|
|
/// <summary>
|
|
/// Has transparency
|
|
/// </summary>
|
|
HasAlphaChannel = 2,
|
|
}
|
|
}
|