Drop listbox item (url) to Internet Explorer

  • Thread starter Thread starter Maik Porkert
  • Start date Start date
M

Maik Porkert

Hi,

i want to drop links I collected in an listbox to an InternetExplorer
instance.

I use currently the following code:

private void listBox1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
DataObject data = new DataObject();
data.SetData(DataFormats.Text, "http://localhost" );
listBox1.DoDragDrop(data, DragDropEffects.All);
}

But this example only runs on Mozilla. Not IE and not Opera. Does anyone
had an example how to do this with that browsers?

I only found a Drag-Example which seems to work with FILEGROUPDESCRIPTOR -
but I don't know how to create such things in C#.

Many Thx
Maik
 
Hi Maik,

I suspect neither IE nor Opera supports drag-drop into the address box
while Mozilla attempts to accept everything (almost to the point of
accepting a bitmap :P).

The common way of using url links is to click on the link which causes the
browser of your choice, or the default one to launch with the specified
link.

Process.Start(url) // opens default browser
Process.Start(operaPath, url); // opens opera

Happy coding!
Morten Wennevik [C# MVP]
 
I suspect neither IE nor Opera supports drag-drop into the address box
while Mozilla attempts to accept everything (almost to the point of
accepting a bitmap :P).

On Delphi there exists an component suite which supports url dropping (Drag
& Drop Suite).

Therefore I mean it must be any way to create a FILEGROUPDESCRIPTOR record
and FILEDESCRIPTOR also in c#

Greetings
Maik
 
Maik,

In order to do this, you are probably going to have to call DoDragDrop
yourself. This is no trivial operation, since you are going to have to
import the IDataObject and IDropSource interfaces, as well as the FORMATETC
and STGMEDIUM structures and then call DoDragDrop on your own.

Hope this helps.
 
Back
Top