Tuesday, April 06, 2004

IEHost, Smart Client and DragDrop

A client of mine was working on adding drag and drop to a Windows Forms control hosted in Internet Explorer that we use.  They wanted to allow a user to drop a group of files, email messages, etc onto this control and then do something with the items that were dropped.  We got it all working great in a Windows Form but the same control hosted in Internet Explorer exhibited two strange behaviors:

  1. Whenever more than one file was dropped onto the control GetData(DataFormats.FileDrop) yielded only the first!  This was a weird one.  Come to find out this was the lack of System.Security.FileIOPermission!  Once we added this attribute: [FileIOPermission(SecurityAction.Assert, Unrestricted=true)] we started to receive more than one file.  According to PSS this is because there is a FileIOPermission demand in GetData() that fails silently after retrieving the first file.  Sounds like a bug to me!
  2. Second issue we ran into is that in the DragDrop handler we wanted to make a remoting call to our controller to have it launch a form. This failed only when we were in a DragDrop handler.  We never determined the root cause here but did determine that the source of the drop is blocked until the DragDrop completes.  Sure seems like I should be able call a method to indicate that is the case but instead you must return from the DragDrop event.  To get around this we did a this.Invoke() on a method containing the work. This allowed the DragDrop event to return and then for our form to be launched.
Tuesday, April 06, 2004 1:31:28 PM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

Comments are closed.

Administration
Sign In