Click here to Skip to main content
15,884,176 members
Articles / Desktop Programming / Win32

.NET Shell Extensions - Shell Info Tip Handlers

Rate me:
Please Sign up or sign in to vote.
4.90/5 (16 votes)
5 Apr 2013CPOL7 min read 54.4K   2K   43  
Rapidly create Shell Info Tip Extensions using .NET
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;

namespace SharpShell.Interop
{
    /// <summary>
    /// The IDropTarget interface is one of the interfaces you implement to provide drag-and-drop operations in your application. It contains methods used in any application that can be a target for data during a drag-and-drop operation. 
    /// </summary>
    [ComImport]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("00000122-0000-0000-C000-000000000046")]
    public interface IDropTarget
    {
        /// <summary>
        /// Indicates whether a drop can be accepted, and, if so, the effect of the drop.
        /// </summary>
        /// <param name="pDataObj">A pointer to the IDataObject interface on the data object. This data object contains the data being transferred in the drag-and-drop operation. If the drop occurs, this data object will be incorporated into the target.</param>
        /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
        /// <param name="pt">A POINTL structure containing the current cursor coordinates in screen coordinates.</param>
        /// <param name="pdwEffect">On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.</param>
        /// <returns>This method returns S_OK on success.</returns>
        int DragEnter(IDataObject pDataObj, uint grfKeyState, POINT pt, ref uint pdwEffect);

        /// <summary>
        /// Provides target feedback to the user and communicates the drop's effect to the DoDragDrop function so it can communicate the effect of the drop back to the source.
        /// </summary>
        /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Valid values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
        /// <param name="pt">A POINTL structure containing the current cursor coordinates in screen coordinates.</param>
        /// <param name="pdwEffect">On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.</param>
        /// <returns>This method returns S_OK on success. </returns>
        int DragOver(uint grfKeyState, POINT pt, ref uint pdwEffect);

        /// <summary>
        /// Removes target feedback and releases the data object.
        /// </summary>
        /// <returns>This method returns S_OK on success.</returns>
        int DragLeave();

        /// <summary>
        /// Incorporates the source data into the target window, removes target feedback, and releases the data object.
        /// </summary>
        /// <param name="pDataObj">A pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation.</param>
        /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
        /// <param name="pt">A POINTL structure containing the current cursor coordinates in screen coordinates.</param>
        /// <param name="pdwEffect">On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.</param>
        /// <returns>This method returns S_OK on success.</returns>
        int Drop(IDataObject pDataObj, uint grfKeyState, POINT pt, ref uint pdwEffect);
        
    };
}

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 Code Project Open License (CPOL)


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