2
我試圖將它從我的C#應用程序對Skype的下降的圖像並出現以下錯誤:「錯誤HRESULT E_FAIL已從調用返回至COM組件」:錯誤HRESULT E_FAIL已從調用COM組件返回。 如文字其他應用程序時,Excel工作正常。試圖拖動時和圖像拖放到Skype的C#
// 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時repproduce相同bahavior Windows資源管理器。有任何想法嗎?
謝謝您的HELS Soonts,我只是改變了下降的數據和工作! – Andre
不客氣。 – Soonts