I too am looking to be able to drag and drop things into the HTML control. I've seen the method GetDropTarget in the HTMLSite class, and I'm guessing I need to put some implementation in here. I initially added a Debug.Writeline in here just to check when the method is being hit, and it seems to fire way before I get as far as dragging anything into the control, then never fires as I drag stuff over the control, which leads me to believe its not right place.

Can anyone provide a code snippet (smiles hopefully at Tim and James) that gives a basic example of drag-drop to the HTML editor. Something to get me started, so I can build on it, doesn't need to be too complex.

Kushan is correct. GetDropTarget isn't something that gets called when you drop something on the control. It's called by mshtml to ask if you want to implement a custom IDropTarget interface. If GetDropTarget doesn't offer an alternative IDropTarget, then mshtml uses its own implementation.

Another idea would be to try to handle the document's ondragend event. I'm sorry I've not done any experimentation in this area.

I added the COM Interface for IDropTarget as shown in the example above, and added IDropTarget to the list of interfaces that HTMLSite implements (including simple Debug.Writeline stuff for the implementation so I can see when events get triggered).

All I am seeing when I try to drag stuff onto the HTML Editor now is System.ExecutionEngineException.

If someone is feeling very benevolent and can throw together a little sample app that perhaps throws up a message box saying "Drop event fired!" or something, I will make them Supreme Overlord of all things COM, Dictator for Life, and one other title of their choosing.... :-)

Making some great progress now, thanks to Kushan's patience with my questions :-) Managed to get HTMLSite to respond to DragEnter and DragLeave events now, still working on DragOver and Drop.

Am I right in thinking that if I want to drag a custom object (ie, an object not of a base type) to the control, then it needs to be of a type that implements IDataObject? If so, I got a whole bunch of methods to be working on....DAdvise, DUnadvise, and more.

i just fixed that one and it is working fine for me. also the drag and drop is restricted from out side. but if i drag it from instide it get strucked. the selected text is still selected even i deselect that. Even i typed some thing then looks like selected.