1

I am trying to make the TEdit control for the program on the "Tool Properties" dialog in the Delphi IDE (*1) accept dropping files from the explorer. This works fine in Delphi 6 and 7 but no longer works in the "new" IDE of Delphi 2005 up.

In Delphi 6/7 dropping a file on the edit control triggers a WM_DROPFILES message which a hook to the WindowProc of the TEdit can catch. In the later versions, no message is received. The hook on WindowProc still works, as it receives all kinds of other messages.

The dialog layout, names and controls is unchanged as far as I can determine.

As a test I even added my own TEdit and TComboBox to the dialog to make sure it's not a problem of these specific existing controls. They are shown fine, but dropping a file doesn't work with these either.

What else could be the problem?

(*1: the one you get through Tools -> Configure Tools -> Add or Edit This will be a new functionality in GExperts. Auto complete already works for these controls.)

The code is here:

http://sourceforge.net/p/gexperts/code/HEAD/tree/trunk/Source/IDE/GX_IdeToolPropertiesEnhancer.pas

and the actual hooking code is here:

http://sourceforge.net/p/gexperts/code/HEAD/tree/trunk/Source/Utils/GX_dzVclUtils.pas

dummzeuch
  • 10,975
  • 4
  • 51
  • 158
  • Is the IDE running elevated in UAC? If so, UIPI will block those messages unless you have the IDE process call [`ChangeWindowMessageFilter()`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms632675.aspx) or [`ChangeWindowMessageFilterEx()`](https://msdn.microsoft.com/en-us/library/windows/desktop/dd388202.aspx) to allow the messages to be sent by lower-privilege processes, such as Explorer running unelevated in the user's context. – Remy Lebeau Oct 26 '15 at 17:43
  • 1
    I would guess because the IDE main form already reacts to that message as they get opened in the editor when you drop them? – Stefan Glienke Oct 26 '15 at 17:57
  • @RemyLebeau no no elevation, neither is the explorer window. – dummzeuch Oct 26 '15 at 18:35
  • @StefanGlienke that's what I would have thought, if it didn't work in any other dialog. But it works fine in the path fields and also in the combo boxes of the run parameters dialog. The controls in those are not TEdit controls though, but custom descendants of TEdit and TCombobox. I actually expected less problems with standard TEdit controls. – dummzeuch Oct 26 '15 at 18:40
  • @StefanGlienke: It is very unlikely that the IDE uses a single global `WM_DROPFILES` handler to handle drag&drop on every droppable control in the IDE. Windows sends `WM_DROPFILES` directly to the control being dropped onto. – Remy Lebeau Oct 26 '15 at 18:44
  • @dummzeuch: Without seeing your actual hook code, it is very difficult to diagnose the problem. – Remy Lebeau Oct 26 '15 at 18:45
  • @RemyLebeau I added links to the code. – dummzeuch Oct 26 '15 at 19:45
  • 1
    @RemyLebeau Well, if you think so then open the IDE and drop a file anywhere in the IDE - in my layout only the structure panel refuses the drop action (indicated by the red icon) - any other control/dockpanel including the main menu accepts the file and it's being opened. – Stefan Glienke Oct 26 '15 at 20:13

0 Answers0