I want to drag a link from a browser to my application and pick up both the url and the title/name associated with it.
I can read the url easily enough:
object o = data.GetData(typeof(string));
if (o != null)
{
if (data.GetDataPresent(DataFormats.Html, true))
{
String htmlsnippet = (string)data.GetData(DataFormats.Html);
processHtml(htmlsnippet);
pasteText((String)o);
The problem is that the html rarely contains the title.
For example www.bbc.co.uk/news
drag this into my app and I see the url
and the htmp snippet is:
Version:0.9StartHTML:00000145EndHTML:00000282
StartFragment:00000179EndFragment:00000246
SourceURL:chrome://browser/content/browser.xul<html><body>
<!--
<a href=\"http://www.bbc.co.uk/news/\">http://www.bbc.co.uk/news/</a><!--
</body></html>
However if I drag this link from my browser to my desk top the short-cut is
called 'BBC News - Home'
Similarly try cnn.com and the shortcut is labelled 'CNN.com International -
Breaking, World ...'
Can anyone help me find the title information? I don't want to retrieve the page as this will slow down the drag and drop, and anyway drag to desktop doesn't do this since it works if you go off-line and then drag a link from the browser to desktop.
Thanks.
[Modified: added pre tags...learn to use them, they are your friend!]