C# アプリから Skype に画像をドラッグ アンド ドロップしようとすると、次のエラーが発生します。COM コンポーネントへの呼び出しからエラー HRESULT E_FAIL が返されました。Word などの他のアプリケーションでは、Excel は問題なく動作します。
// Find the data behind the ListViewItem
DashboardItem item = (DashboardItem)listView.ItemContainerGenerator.
ItemFromContainer(listViewItem);
DragDropEffects returnedEffect = DragDropEffects.None;
dragging = true;
switch (item.Type)
{
case DashboardItem.ContentType.IMG:
BitmapSource realFile = new BitmapImage(new Uri(item.Content));
if (realFile != null)
{
using (MemoryStream bitmapAsStream = Utils.BitmapSourceToStream(realFile))
{
if (bitmapAsStream != null)
{
using (MemoryStream dib = new MemoryStream())
{
dib.Write(bitmapAsStream.GetBuffer(), 14, (int)(bitmapAsStream.Length - 14));
DataObject dragData = new DataObject(DataFormats.Dib, dib);
//Error next line
returnedEffect = DragDrop.DoDragDrop(listViewItem, dragData, DragDropEffects.Copy);
bitmapAsStream.Close();
dib.Close();
}
}
}
}
}
break;
Skype に画像をドロップするとき、Windows エクスプローラーと同じ動作を再現したいと考えています。何か案は?