FileDragAndDropTarget not working windows7?


#1

Hi,

I’m using 1.51 and have a content component derived from FileDragAndDropTarget.

I’m overriding isInterestedInFileDrag() and filesDropped() and on windows XP (and Mac) it works fine as expected. On windows7 when I drag a file from the desktop over the component the cursor becomes a ‘no entry’ cursor and neither the isInterestedInFileDrag() nor filesDropped() functions are called.

Does windows7 do some pre-filtering of drag-drop? if so, does anyone know how to specify what files windows7 should allow to be dropped on my app?
If not, is there a workaround/fix for this??!

Thanks.


#2

I’ve just investigated a bit further… the problem lies with the fact that our app runs with administrator privileges.

The Juce demo and our component work fine with file drag-drop in windows7 if NOT run with administrator privileges, but the app needs to run as admin because it’s a download manager/installer type app.

You can recreate the problem with the juce demo by right clicking and ‘Run as administrator’.

Does anyone know how to get a juce app (or any app for that matter) running as administrator to accept files dropped on it?

thanks -


#3

1.51 is pretty old now, you should try the latest tip version to see if anything has changed.


#4

hi again,

It seems this isn’t a problem with Juce at all, but if anyone else has the same problem there is some info about it here:
http://social.msdn.microsoft.com/forums/en-US/windowsuidevelopment/thread/2fa935cf-be57-4bcc-9b96-7ee5a6b2b7a5/

unfortunately there doesn’t seem to be a workaround atm on windows7

cheers -


#5

It seems there is!

I guess we need to have
ChangeWindowMessageFilter (WM_DROPFILES, MSGFLT_ADD);
ChangeWindowMessageFilter (WM_COPYDATA, MSGFLT_ADD);
ChangeWindowMessageFilter (0x0049, MSGFLT_ADD);

in void MessageManager::doPlatformSpecificInitialisation() ?


#6

Interesting!

It seems that ChangeWindowMessageFilter is deprecated, but how about adding this to juce_win32_Windowing.cpp, line 1351:

ChangeWindowMessageFilterEx (hwnd, WM_DROPFILES, MSGFLT_ALLOW, nullptr); ChangeWindowMessageFilterEx (hwnd, WM_COPYDATA, MSGFLT_ALLOW, nullptr); ChangeWindowMessageFilterEx (hwnd, 0x49, MSGFLT_ALLOW, nullptr);

I don’t really have a way to test the original problem, so would appreciate knowing if this helps!