Reporting drag failure to windows


#1

In juce’s windows-specific code to handle drag-and-drop, there’s a call to IDataObject::GetData in JuceDropTarget::updateFileList. Only if GetData succeeds does updateFileList do anything, but I think that return value needs to bubble up to the callers of updateFileList and make its way back to the OS.

From the Notes to Implementers section of http://msdn.microsoft.com/en-us/library/windows/desktop/ms678431(v=vs.85).aspx:[quote]If the data object cannot comply with the information specified in the FORMATETC, the method should return DV_E_FORMATETC. If an attempt to allocate the medium fails, the method should return STG_E_MEDIUMFULL.[/quote]
Something like this at the beginning of DragEnter and Drop is what I’m talking about:

HRESULT hr = updateFileList (pDataObject); if (hr != S_OK) return hr; Without this change, I may get my filesDropped method called with 0 files. With this change the OS displays a do not enter symbol and doesn’t let the user drop data that IDataObject::GetData can’t handle. In my specific test, IDataObject::GetData returns DV_E_FORMATETC.


#2

Thanks! I’ve made this change if you want to take a look and sanity-check what I’ve done…


#3

I don’t see it here: http://juce.git.sourceforge.net/git/gitweb.cgi?p=juce/juce;a=blob_plain;f=src/native/windows/juce_win32_Windowing.cpp;hb=HEAD. Am I looking in the right place?


#4

All my latest stuff is on the modules branch.


#5

Looks good.