Click here to Skip to main content
15,879,095 members
Articles / Desktop Programming / Win32

.NET Shell Extensions - Shell Preview Handlers

Rate me:
Please Sign up or sign in to vote.
4.93/5 (23 votes)
20 May 2014MIT8 min read 140K   6.1K   71  
Quickly create Shell Preview Handlers for Windows or Outlook using .NET!
using System.Runtime.InteropServices;

namespace SharpShell.Interop
{
    /// <summary>
    /// Enables preview handlers to pass keyboard shortcuts to the host. This interface retrieves a list of keyboard shortcuts and directs the host to handle a keyboard shortcut.
    /// </summary>
    [ComImport]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("fec87aaf-35f9-447a-adb7-20234491401a")]
    public interface IPreviewHandlerFrame
    {
        /// <summary>
        /// Gets a list of the keyboard shortcuts for the preview host.
        /// </summary>
        /// <param name="pinfo">A pointer to a PREVIEWHANDLERFRAMEINFO structure that receives accelerator table information.</param>
        /// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
        [PreserveSig]
        int GetWindowContext(PREVIEWHANDLERFRAMEINFO pinfo);

        /// <summary>
        /// Directs the host to handle an keyboard shortcut passed from the preview handler.
        /// </summary>
        /// <param name="pmsg">A pointer to a WM_COMMAND or WM_SYSCOMMAND window message that corresponds to a keyboard shortcut.</param>
        /// <returns>If the keyboard shortcut is one that the host intends to handle, the host will process it and return S_OK; otherwise, it returns S_FALSE.</returns>
        [PreserveSig]
        int TranslateAccelerator(MSG pmsg);
    };
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer
United Kingdom United Kingdom
Follow my blog at www.dwmkerr.com and find out about my charity at www.childrenshomesnepal.org.

Comments and Discussions