IDropTarget::DragEnter method (oleidl.h)
Indicates whether a drop can be accepted, and, if so, the effect of the drop.
HRESULT DragEnter( IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
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.
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.
A POINTL structure containing the current cursor coordinates in screen coordinates.
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.
This method returns S_OK on success. Other possible values include the following.
||An unexpected error has occurred.|
||The pdwEffect parameter is NULL on input.|
||There was insufficient memory available for this operation.|
You do not call DragEnter directly; instead the DoDragDrop function calls it to determine the effect of a drop the first time the user drags the mouse into the registered window of a drop target.
To implement DragEnter, you must determine whether the target can use the data in the source data object by checking three things:
- The format and medium specified by the data object
- The input value of pdwEffect
- The state of the modifier keys
On entry to IDropTarget::DragEnter, the pdwEffect parameter is set to the effects given to the pdwOkEffect parameter of the DoDragDrop function. The IDropTarget::DragEnter method must choose one of these effects or disable the drop.
The following modifier keys affect the result of the drop.
|Key Combination||User-Visible Feedback||Drop Effect|
|CTRL + SHIFT||=||DROPEFFECT_LINK|
|No keys or SHIFT||None||DROPEFFECT_MOVE|
On return, the method must write the effect, one of the DROPEFFECT flags, to the pdwEffect parameter. DoDragDrop then takes this parameter and writes it to its pdwEffect parameter. You communicate the effect of the drop back to the source through DoDragDrop in the pdwEffect parameter. The DoDragDrop function then calls IDropSource::GiveFeedback so that the source application can display the appropriate visual feedback to the user through the target window.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|