drag and drop issues (I'm using VS.NET 2005 beta 2)

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I started playing with Drag&Drop in my application.
I start dragging with code like that:

myControl.DoDragDrop(value, DragDropEffects.Copy);
where value is an instance of some business object.

When I drag my value around and move it over my controls or an other app
like Paint, everything behave allright.

However if I mouse over the FileExplorer or the TaskBar I got
COMException was unhandled with the message:
Invalid FORMATETC structure (Exception from HRESULT: 0x80040064
(DV_E_FORMATETC))

The stack trace doesn't cross my code at all!...
(below is a copy of the COMPLETE stack trace)
at
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo)
at System.Windows.Forms.DataObject.GetDataIntoOleStructs(FORMATETC&
formatetc, STGMEDIUM& medium)
at
System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(FORMATETC&
formatetc, STGMEDIUM& medium)
at
System.Windows.Forms.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC&
formatetc, STGMEDIUM& medium)


As a side note, if I click OK/Continue, I have a few such errors in a row
(so multiple click on the OK button), and then the application continue
allright instead of dying.... (I have no top level cath & continue code).


Any ideas or tips?
 
Out of curiosity, even though my business object are in a data assembly
which is NOT normaly linked to System.Windows.Forms I, for the sake of the
test, linked with SWF, inherit SWF.DataObject and override

public override string[] GetFormats();
public override string[] GetFormats(bool b);

even after this change, I kept having the bug :-(
 
Lloyd said:
Out of curiosity, even though my business object are in a data assembly
which is NOT normaly linked to System.Windows.Forms I, for the sake of the
test, linked with SWF, inherit SWF.DataObject and override

public override string[] GetFormats();
public override string[] GetFormats(bool b);

even after this change, I kept having the bug :-(

I've seen this as well, but I don't currently have an idea where it
comes from. So far I haven't bothered to debug it any further... IIRC,
the exception surfaces only if the app is running in the debugger, so it
seems to be caught somewhere.



Oliver Sturm
 
Back
Top