| Previous | Next |
| DRAGDROP_E_NOTREGISTERED | DRAGDROP_E_INVALIDHWND |
DRAGDROP_E_ALREADYREGISTERED
This window has already been registered as a drop target
DRAGDROP_E_ALREADYREGISTERED has hexadecimal value 0x80040101 (unsigned 2147746049, signed -2147221247). AllStat records “This window has already been registered as a drop target”. The narrow interpretation is that RegisterDragDrop was called for an HWND that already has an OLE drop target. The failing stage is enabling drag-and-drop or replacing an IDropTarget on a live window.
The high bit in 0x80040101 is set, so this is a failure rather than a success or informational result. Its facility field is 4 (FACILITY_ITF) and its low 16-bit code is 257 (0x0101). Those bit fields classify the value, but they do not identify the failing object by themselves; the native method, object identity, and first producer of DRAGDROP_E_ALREADYREGISTERED remain essential.
API stage
Understanding DRAGDROP_E_ALREADYREGISTERED requires this subsystem context: OLE drag-and-drop registration is tied to an HWND, its UI thread, and a COM apartment. For DRAGDROP_E_ALREADYREGISTERED, isWindow checks can describe a moment in time, but lifecycle serialization is what prevents stale handles, duplicate registration, and reentrant drag sessions.
- Associate
DRAGDROP_E_ALREADYREGISTEREDwith one exact operation in RegisterDragDrop, RevokeDragDrop, DoDragDrop, window lifetime, and IDropTarget ownership. - Confirm that
DRAGDROP_E_ALREADYREGISTEREDcame from enabling drag-and-drop or replacing an IDropTarget on a live window, rather than from cleanup or a wrapper that ran afterward. - Preserve any IErrorInfo, underlying Win32 result, provider message, or callback failure that preceded
DRAGDROP_E_ALREADYREGISTERED; the HRESULT alone should not erase a more specific cause.
Verification steps
- Capture
DRAGDROP_E_ALREADYREGISTEREDat the first native return before a wrapper maps it to a generic exception. - Identify the exact object, method, and lifecycle phase involved in enabling drag-and-drop or replacing an IDropTarget on a live window.
- Identify the component that performed the first successful registration.
- Record the IDropTarget identity and feature owner in window state.
- Check subclassing, docking, and framework startup paths for duplicate enablement.
- Reproduce
DRAGDROP_E_ALREADYREGISTEREDwith one controlled input or state change, and verify that the correction changes the decisive evidence rather than merely hiding the result.
Interpretation limits
DRAGDROP_E_ALREADYREGISTEREDcan result when initialization is invoked twice without paired revocation.DRAGDROP_E_ALREADYREGISTEREDcan result when a framework registered its own drop target before application code.DRAGDROP_E_ALREADYREGISTEREDcan result when the window handle is reused while stale application bookkeeping says it is a new instance.
Incident record
A useful DRAGDROP_E_ALREADYREGISTERED incident records the HWND value, creating thread, apartment type, registration state, IDropTarget identity, active drag sequence, mouse capture, and destruction or recreation events. For DRAGDROP_E_ALREADYREGISTERED, also retain the application and component build, architecture, process and thread IDs, COM apartment, operation correlation ID, elapsed time, and the first state-changing event before the failure. When logging DRAGDROP_E_ALREADYREGISTERED, redact content and credentials while preserving types, lengths, hashes, opaque identities, and lifecycle generations needed to reproduce its contract.
- For
DRAGDROP_E_ALREADYREGISTERED, identify the component that performed the first successful registration. - For
DRAGDROP_E_ALREADYREGISTERED, record the IDropTarget identity and feature owner in window state. - For
DRAGDROP_E_ALREADYREGISTERED, check subclassing, docking, and framework startup paths for duplicate enablement.
Recovery conditions
Correction. For DRAGDROP_E_ALREADYREGISTERED, reuse the existing target, coordinate ownership with the framework, or revoke once before registering the replacement on the owning thread. Retry boundary. Retry is safe only after successful RevokeDragDrop and after preventing active drags from observing a half-swapped target. Before repeating the DRAGDROP_E_ALREADYREGISTERED operation, finish or cancel any active drag, pair each successful registration with one revocation, and verify that the HWND still belongs to the same window generation.
Practical scenario
A UI toolkit enables OLE drops automatically, then a plugin registers another target on the same HWND; the plugin integrates with the toolkit target instead of overwriting it. This isolates DRAGDROP_E_ALREADYREGISTERED within OLE drag-and-drop registration and modal tracking and provides a regression test for the stated correction.
Difference from related HRESULTs
DRAGDROP_E_NOTREGISTERED reports an extra revoke; DRAGDROP_E_ALREADYREGISTERED reports an extra register. For DRAGDROP_E_ALREADYREGISTERED, keep those outcomes separate in exception mappings, telemetry dimensions, user messages, and automated retry policy.
Developer and administrator guidance
For DRAGDROP_E_ALREADYREGISTERED, own registration state on the HWND’s UI thread, tie it to the window generation, and guard DoDragDrop against reentrant starts. Regression coverage for DRAGDROP_E_ALREADYREGISTERED should include duplicate enable and disable paths, HWND recreation, framework-owned drop targets, destruction during registration, and nested input dispatch while a drag is active.
Operational repair for DRAGDROP_E_ALREADYREGISTERED must target the evidence-backed owner: identify whether the application, UI framework, shell extension, or plugin owns the target before changing configuration; machine-wide COM repair is not justified by a per-window lifecycle defect. Retain before-and-after traces for DRAGDROP_E_ALREADYREGISTERED so the change can be attributed and reversed.
References
- Microsoft: generic COM error codes — official Microsoft documentation relevant to
DRAGDROP_E_ALREADYREGISTERED. - Microsoft: HRESULT values — official Microsoft documentation relevant to
DRAGDROP_E_ALREADYREGISTERED. - Microsoft: RegisterDragDrop — official Microsoft documentation relevant to
DRAGDROP_E_ALREADYREGISTERED. - Microsoft: RevokeDragDrop — official Microsoft documentation relevant to
DRAGDROP_E_ALREADYREGISTERED. - Microsoft: DoDragDrop — official Microsoft documentation relevant to
DRAGDROP_E_ALREADYREGISTERED.
Looking for a different code? Search another status or error code.
