Thomas Mueller - 2026-10-17

Cause, measured with real drags on the Tool Properties dialog and with GxInspect's new DROPFILES command:

Windows first looks for an OLE drop target (RegisterDragDrop), starting at the window under the cursor and going up through its parents and, for a dialog, its owners. Only if there is none, or it refuses the drop, does the nearest window that called DragAcceptFiles get WM_DROPFILES.

  • Delphi 2007: the Tool Properties dialog is owned by the IDE main window, whose OLE drop target accepts the file and opens it in the code editor. The WM_DROPFILES handler on the edits is never reached.
  • Delphi 13: the IDE main window's drop target refuses while the dialog is modal, so the edits get WM_DROPFILES and the existing code works. A real drag on the Program field worked.

So the fix for the versions where it fails is to register OLE drop targets (TDropFileTarget) on the three edits themselves, so Windows finds them before it reaches the IDE main window. That can be tested with DROPFILES, which hands the files to the same window a real drag would.