Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsDropTargetMBS class.

WindowsDropTargetMBS.AttachToControl(ctl as control, showDragImage as boolean = true) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Drag & Drop MBS Win Plugin 11.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Attached the drop target to the control.

This method unregistered any existing drop target on the control (including the one from Xojo).

Registers the specified control as one that can be the target of an OLE drag-and-drop operation and specifies the WindowsDropTargetMBS instance to use for drop operations.

ctl: The control that can be a target for an OLE drag-and-drop operation.
showDragImage: Whether we should support the drag image methods in the newer Windows versions.

This function returns S_OK on success. Other possible values include the following.

Return codeDescription
DRAGDROP_E_INVALIDHWNDInvalid handle returned in the hwnd parameter.
DRAGDROP_E_ALREADYREGISTEREDThe specified window has already been registered as a drop target.
E_OUTOFMEMORYInsufficient memory for the operation.

If your application can accept dropped objects during OLE drag-and-drop operations, you must call the AttachToControl function. Do this whenever one of your application windows is available as a potential drop target, i.e., when the window appears unobscured on the screen.

AttachToControl must be called on the main thread of your application.

The AttachToControl function only registers one control at a time, so you must call it for each application control capable of accepting dropped objects. For each control, you need your own instance of the WindowsDropTargetMBS class.

As the mouse passes over unobscured portions of the target control during an OLE drag-and-drop operation, the DoDragDrop function calls the specified WindowsDropTargetMBS.DragOver method for the current control. When a drop operation actually occurs in a given control, the DoDragDrop function calls WindowsDropTargetMBS.Drop.

See also:

Some examples using this method:

WindowsDropTargetMBS.AttachToControl(ctl as DesktopControl, showDragImage as boolean = true) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Drag & Drop MBS Win Plugin 22.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Attached the drop target to the control.

This method unregistered any existing drop target on the control (including the one from Xojo).

Registers the specified control as one that can be the target of an OLE drag-and-drop operation and specifies the WindowsDropTargetMBS instance to use for drop operations.

ctl: The control that can be a target for an OLE drag-and-drop operation.
showDragImage: Whether we should support the drag image methods in the newer Windows versions.

This function returns S_OK on success. Other possible values include the following.

Return codeDescription
DRAGDROP_E_INVALIDHWNDInvalid handle returned in the hwnd parameter.
DRAGDROP_E_ALREADYREGISTEREDThe specified window has already been registered as a drop target.
E_OUTOFMEMORYInsufficient memory for the operation.

If your application can accept dropped objects during OLE drag-and-drop operations, you must call the AttachToControl function. Do this whenever one of your application windows is available as a potential drop target, i.e., when the window appears unobscured on the screen.

AttachToControl must be called on the main thread of your application.

The AttachToControl function only registers one control at a time, so you must call it for each application control capable of accepting dropped objects. For each control, you need your own instance of the WindowsDropTargetMBS class.

As the mouse passes over unobscured portions of the target control during an OLE drag-and-drop operation, the DoDragDrop function calls the specified WindowsDropTargetMBS.DragOver method for the current control. When a drop operation actually occurs in a given control, the DoDragDrop function calls WindowsDropTargetMBS.Drop.

See also:

WindowsDropTargetMBS.AttachToWindow(win as DesktopWindow, showDragImage as boolean = true) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Drag & Drop MBS Win Plugin 22.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Attached the drop target to the window.

This method unregistered any existing drop target on the window (including the one from Xojo).

Registers the specified window as one that can be the target of an OLE drag-and-drop operation and specifies the WindowsDropTargetMBS instance to use for drop operations.

Win: The window that can be a target for an OLE drag-and-drop operation.
showDragImage: Whether we should support the drag image methods in the newer Windows versions.

This function returns S_OK on success. Other possible values include the following.

Return codeDescription
DRAGDROP_E_INVALIDHWNDInvalid handle returned in the hwnd parameter.
DRAGDROP_E_ALREADYREGISTEREDThe specified window has already been registered as a drop target.
E_OUTOFMEMORYInsufficient memory for the operation.

If your application can accept dropped objects during OLE drag-and-drop operations, you must call the AttachToWindow function. Do this whenever one of your application windows is available as a potential drop target, i.e., when the window appears unobscured on the screen.

AttachToWindow must be called on the main thread of your application.

The AttachToWindow function only registers one window at a time, so you must call it for each application window capable of accepting dropped objects. For each window, you need your own instance of the WindowsDropTargetMBS class.

As the mouse passes over unobscured portions of the target window during an OLE drag-and-drop operation, the DoDragDrop function calls the specified WindowsDropTargetMBS.DragOver method for the current window. When a drop operation actually occurs in a given window, the DoDragDrop function calls WindowsDropTargetMBS.Drop.

See also:

Some examples using this method:

WindowsDropTargetMBS.AttachToWindow(win as window, showDragImage as boolean = true) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Drag & Drop MBS Win Plugin 10.5 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Attached the drop target to the window.

This method unregistered any existing drop target on the window (including the one from Xojo).

Registers the specified window as one that can be the target of an OLE drag-and-drop operation and specifies the WindowsDropTargetMBS instance to use for drop operations.

Win: The window that can be a target for an OLE drag-and-drop operation.
showDragImage: Whether we should support the drag image methods in the newer Windows versions.

This function returns S_OK on success. Other possible values include the following.

Return codeDescription
DRAGDROP_E_INVALIDHWNDInvalid handle returned in the hwnd parameter.
DRAGDROP_E_ALREADYREGISTEREDThe specified window has already been registered as a drop target.
E_OUTOFMEMORYInsufficient memory for the operation.

If your application can accept dropped objects during OLE drag-and-drop operations, you must call the AttachToWindow function. Do this whenever one of your application windows is available as a potential drop target, i.e., when the window appears unobscured on the screen.

AttachToWindow must be called on the main thread of your application.

The AttachToWindow function only registers one window at a time, so you must call it for each application window capable of accepting dropped objects. For each window, you need your own instance of the WindowsDropTargetMBS class.

As the mouse passes over unobscured portions of the target window during an OLE drag-and-drop operation, the DoDragDrop function calls the specified WindowsDropTargetMBS.DragOver method for the current window. When a drop operation actually occurs in a given window, the DoDragDrop function calls WindowsDropTargetMBS.Drop.

See also:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...