IDragSourceHelper::InitializeFromWindow method (shobjidl_core.h)

Initializes the drag-image manager for a control with a window.

Syntax

HRESULT InitializeFromWindow(
  [in] HWND        hwnd,
  [in] POINT       *ppt,
  [in] IDataObject *pDataObject
);

Parameters

[in] hwnd

Type: HWND

A handle to the window that receives the DI_GETDRAGIMAGE message. This value can be NULL.

[in] ppt

Type: POINT*

A pointer to a POINT structure that specifies the location of the cursor within the drag image. The structure should contain the offset from the upper-left corner of the drag image to the location of the cursor. This value can be NULL.

[in] pDataObject

Type: IDataObject*

A pointer to the data object's IDataObject interface.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The DI_GETDRAGIMAGE message allows you to source a drag image from a custom control. It is defined in Shlobj.h and must be registered with RegisterWindowMessage. When the window specified by hwnd receives the DI_GETDRAGIMAGE message, the lParam value holds a pointer to an SHDRAGIMAGE structure. The handler should fill the structure with the drag image bitmap information.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll (version 5.0 or later)

See also

IDragSourceHelper