IPreviewHandler (shlwapi)
Last changed: -206.116.16.22

.
Summary
This interface describes the API implemented by preview handlers. When a handler for a given file type is installed on a system, the shell or custom apps can use it to display the contents of these files in their window. Preview handlers usually do not allow in-place editing and may not display all the information contained in the file (for example, macros inside Office documents are ignored by their preview handlers)

C# Signature:

[System.Runtime.InteropServices.ComImport]

[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

[Guid("8895b1c6-b41f-4c1c-a562-0d564250836f")]

public interface IPreviewHandler

{

    void SetWindow(IntPtr hwnd, ref RECT rect);
    void SetRect(ref RECT rect);
    void DoPreview();
    void Unload();

    void SetFocus();
    void QueryFocus(out IntPtr phwnd);

    [PreserveSig]
    uint TranslateAccelerator(ref MSG pmsg);

}

VB Signature:

TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

This interface does NOT have a way to tell the preview handler what file it should show!! For this reason, all preview handler COM objects must also support at least one of IInitializeWithFile or IInitializeWithStream, which is how they get this crucial piece of information.

Tips & Tricks:

You can use this interface to leverage previewers already installed on a system to display a document preview in a Windows Forms app.

In case you want a ready-to-use control for .Net based on IPreviewHandler check out this:

http://www.jam-software.de/shellbrowser_net/file-preview.shtml

Sample Code:

Please add some!

Documentation