Click here to Skip to main content
15,906,097 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cleaning a Stream Pin
Heath Stewart11-May-04 9:15
protectorHeath Stewart11-May-04 9:15 
GeneralRe: Cleaning a Stream Pin
Snowjim11-May-04 9:39
Snowjim11-May-04 9:39 
GeneralFramework 1.0 vs Framework 1.1 Pin
Alex Getman11-May-04 5:27
Alex Getman11-May-04 5:27 
GeneralRe: Framework 1.0 vs Framework 1.1 Pin
Dave Kreskowiak11-May-04 6:13
mveDave Kreskowiak11-May-04 6:13 
GeneralRe: Framework 1.0 vs Framework 1.1 Pin
Alex Getman11-May-04 6:27
Alex Getman11-May-04 6:27 
GeneralRe: Framework 1.0 vs Framework 1.1 Pin
Heath Stewart11-May-04 6:44
protectorHeath Stewart11-May-04 6:44 
GeneralFile preview in windows explorer Pin
pedery11-May-04 5:21
pedery11-May-04 5:21 
GeneralRe: File preview in windows explorer Pin
Heath Stewart11-May-04 7:08
protectorHeath Stewart11-May-04 7:08 
This is done via the IExtractImage shell interface. You can find more information about the interface here[^].

If you want to leverage this functionality in your .NET application, see Thumbnail Extraction Using the Shell[^] (something I found quick by googling).

If you have created a document format in .NET and want to support this interface, you must declare this interface in your code like this:
[Guid("BB2E617C-0920-11d1-9A0B-00C04FC2D6C1")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IExtractImage
{
  void GetLocation(
    [MarshalAs(UnmanagedType.LPTStr), Out] string path,
    [MarshalAs(UnmanagedType.U4), In] int pathSize,
    [MarshalAs(UnmanagedType.U4), In, Out] ref int priority,
    [In] ref Size size,
    [MarshalAs(UnmanagedType.U4), In] int RecClrDepth,
    [MarshalAs(UnmanagedType.U4), In, Out] ref int flags);
  void Extract(IntPtr hBitmap);
}
You implement this interface on a class that also exposes a CLSID (Class ID - use the GuidAttribute to explicitly define a CLSID using uuidgen.exe or something). You then register this using regasm.exe from the .NET Framework. The usual regsvr32.exe will not work since an assembly does not export the necessary functions (like DllRegisterServer).

See Nick's article, Creating a CCW for COM-Enabled, non-.NET Applications[^], for more information on exposing .NET classes as COM components.

You would also have to manually register this CLSID under the PersistentHandler registery key under your extension's registry key. This is how the shell determines if your extension supports thumbnails and determines how to load them (using the CLSID of your class). More information about this is available in the Platform SDK. You can make this easier by attributing a couple static methods with the ComRegisterFunctionAttribute and ComUnregisterFunctionATtribute, which executes code (like your registry code) in addition to the standard stuff that regasm.exe does when it's executed with your assembly as it's command-line parameter.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: File preview in windows explorer Pin
pedery19-May-04 6:03
pedery19-May-04 6:03 
GeneralRe: File preview in windows explorer Pin
Heath Stewart19-May-04 6:15
protectorHeath Stewart19-May-04 6:15 
GeneralWindows form Usercontrol hosted in IE Pin
Tim Kohler11-May-04 5:20
Tim Kohler11-May-04 5:20 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Heath Stewart11-May-04 6:50
protectorHeath Stewart11-May-04 6:50 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Tim Kohler11-May-04 8:40
Tim Kohler11-May-04 8:40 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Heath Stewart11-May-04 8:45
protectorHeath Stewart11-May-04 8:45 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Tim Kohler12-May-04 3:10
Tim Kohler12-May-04 3:10 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Heath Stewart12-May-04 3:52
protectorHeath Stewart12-May-04 3:52 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Tim Kohler12-May-04 4:00
Tim Kohler12-May-04 4:00 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Heath Stewart12-May-04 4:29
protectorHeath Stewart12-May-04 4:29 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Tim Kohler12-May-04 4:56
Tim Kohler12-May-04 4:56 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Heath Stewart12-May-04 5:27
protectorHeath Stewart12-May-04 5:27 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Tim Kohler12-May-04 15:40
Tim Kohler12-May-04 15:40 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Heath Stewart13-May-04 2:02
protectorHeath Stewart13-May-04 2:02 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Tim Kohler14-May-04 10:53
Tim Kohler14-May-04 10:53 
GeneralRe: Windows form Usercontrol hosted in IE Pin
Heath Stewart14-May-04 11:00
protectorHeath Stewart14-May-04 11:00 
GeneralTooltip Pin
bertcox11-May-04 4:32
bertcox11-May-04 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.