Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

IPreviewHandler (shlwapi)
 
.
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

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions