Browse Prior Art Database

Drag-and-Drop to OLE Drop Targets and Non-OLE Windows Within the Same Operation.

IP.com Disclosure Number: IPCOM000013870D
Original Publication Date: 1999-Oct-01
Included in the Prior Art Database: 2003-Jun-18

Publishing Venue

IBM

Related People

Authors:
Mark Sibert

Abstract

The following disclosure describes a mechanism that allows a program to drag-and-drop information to other programs. The described mechanism is superior to other drag-and-drop implementations because it can work with both standard Windows controls and OLE drop targets, each of which requires a different (and mutually exclusive) implementation, without having prior knowledge of which type of drop target the user is dragging to. Existing drag-and-drop implementations only support standard Windows controls or OLE drop targets not both. There are two methods of implementing "drag and drop" tasks in a Windows environment, which are mutually exclusive. The first method is a "brute force" method. The second (and usually preferable) method is to use COM. The "brute force method" is usually used to drag information to a standard Windows control and works as follows: The application detects that the user has clicked the mouse button and held it down The application captures all mouse input until the mouse button is released As the mouse pointer moves across the screen, the application is notified and can take appropriate action, such as changing the bitmap used to display the cursor to indicate whether or not a drop is allowed at the current position on the screen. When the mouse button is released, the application determines the target window for the drop operation and, if a drop is allowed, transfers the information to the target window. The "COM method" is used to drag information to an OLEDropTarget control and works as follows: The application detects that the user has clicked the mouse button and held it down The application creates an OLEDropSource object and fills in information for the drag-and-drop operation The application calls the COM DoDragDrop() function on the OLEDropSource object The underlying COM code then handles the actual drag-and-drop operation, from tracking the mouse movement, changing the mouse cursor when a drop is allowed or not allowed, detecting the release of the mouse button, and transferring the information to the target OLE control.