How Windows 98 Processed Desktop Drag and Drop
In Microsoft Windows 98, dragging and dropping items on the desktop
was handled through a combination of the Win32 messaging system, the
Windows Shell architecture, and Object Linking and Embedding (OLE) COM
interfaces. When a user clicked and moved an icon across the desktop,
the operating system coordinated mouse input thresholds with Explorer’s
list-view controls and standardized interfaces—specifically
IDataObject, IDropSource, and
IDropTarget—to negotiate visual feedback, resolve file
operations, and update the desktop namespace.
The Desktop Environment and Window Hierarchy
The Windows 98 desktop was not a static background; it was an active
instance of the Windows Explorer process (explorer.exe).
The desktop surface was implemented as a specialized
SysListView32 control hosted within a window hierarchy
consisting of the Progman (Program Manager) or
WorkerW class windows. Because the desktop was essentially
a list-view control displaying a Shell folder
(C:\Windows\Desktop), it was pre-configured to handle both
standard graphical user interface events and Shell-specific COM
interactions provided by SHELL32.DLL and
OLE32.DLL.
Drag Detection and Initiation
When a user pressed the primary or secondary mouse button over a
desktop icon, the desktop window received a standard Win32
WM_LBUTTONDOWN or WM_RBUTTONDOWN message.
Windows 98 did not immediately treat this as a drag-and-drop action.
Instead, the system monitored mouse movement using coordinates provided
by WM_MOUSEMOVE.
A drag sequence was formally initiated only after the cursor moved
beyond the operating system’s drag sensitivity threshold. These
thresholds were determined by the system metrics SM_CXDRAG
and SM_CYDRAG (typically 4 pixels in width and height). If
the mouse traveled outside this bounding rectangle while the button
remained depressed, the Shell recognized that a drag operation was
underway and initiated OLE drag-and-drop by calling the API function
DoDragDrop.
Data Packaging via IDataObject and IDropSource
Upon calling DoDragDrop, the initiating Shell list-view
packaged the selected desktop items into a COM object implementing the
IDataObject interface. This object contained clipboard
formats representing the selected files or shortcuts:
CF_HDROP: A standard handle referencing a list of file paths on the physical file system.CFSTR_SHELLIDLIST: A Shell-specific format containing an array of Item Identifier Lists (PIDLs), which represented virtual Shell objects and namespace paths.CFSTR_PREFERREDDROPEFFECT: Indicated whether the default action should be a copy, move, or shortcut creation.
Simultaneously, the source provided an IDropSource
interface. This interface was responsible for determining whether the
drag should continue via QueryContinueDrag and updating the
cursor icon to show user feedback (such as a plus sign for copy, an
arrow for a shortcut, or a prohibited symbol) through
GiveFeedback.
Target Negotiation and Tracking
As the cursor traversed the screen, Windows continuously identified
the window beneath the cursor using hit-testing APIs. During startup,
the desktop window had registered itself as a valid drop recipient via
RegisterDragDrop, tying the window handle
(HWND) to an implementation of
IDropTarget.
As the mouse moved over the desktop or other windows:
IDropTarget::DragEnter: Called when the cursor first moved over the drop target. The desktop inspected the formats inside theIDataObjectto verify if it could accept the payload.IDropTarget::DragOver: Called repeatedly as the mouse moved across the desktop surface. The desktop evaluated the target location (for example, hovering over empty desktop space versus hovering over a folder or the Recycle Bin icon) and returned the allowed effect (DROPEFFECT_MOVE,DROPEFFECT_COPY, orDROPEFFECT_LINK).IDropTarget::DragLeave: Called if the cursor exited the desktop area without dropping the object, resetting any highlight states.
If the user held modifier keys during the drag, the desktop altered
the operation: holding Ctrl forced a copy operation,
holding Shift forced a move operation, and holding
Ctrl+Shift forced the creation of a shortcut
(.lnk file). If the right mouse button was used, the
desktop prepared to display a context menu upon release.
Finalizing the Drop
When the user released the mouse button,
IDropSource::QueryContinueDrag reported
DRAGDROP_S_DROP, causing DoDragDrop to invoke
the IDropTarget::Drop method on the desktop list-view.
The desktop's IDropTarget retrieved the data formats
from the IDataObject. If dropped onto an empty area of the
desktop:
- The Shell transferred or created the physical files in the
C:\Windows\Desktopdirectory. - If the right mouse button was released, the Shell popped up a context menu asking the user to choose between "Move Here", "Copy Here", "Create Shortcut(s) Here", or "Cancel".
- The list-view recorded the exact screen coordinates where the drop occurred and saved the X and Y coordinates to the user's Shell state registry settings.
- The desktop control invalidated the affected screen region, added the new icons, and redrew the desktop display.