Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

File name blank when dragging and dropping

$
0
0
Hi, 

I am using Windows 7 32bit with Outlook 2007.  When dragging and dropping an email onto a form, the FileName is blank. This worked in a previous version of Aspose.Email. Please see code below:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;

namespace DragDropTest
{
    public partial class Form1 : Form
    {
        private Aspose.Windows.Forms.FileDropTargetManager asposeFileDropMgr;

        public Form1()
        {
            InitializeComponent();

            this.AllowDrop = true;
        }

        public void HandleApplicationDragDrop(Aspose.Windows.Forms.FileDragEventArgs dragdropArgs)
        {
            for (int stepIndex = 0; stepIndex < dragdropArgs.Files.Count; stepIndex++)
            {
                string documentName = Path.GetFileName(dragdropArgs.Files[stepIndex].FileName);

                MessageBox.Show("The name is " + documentName); //This is blank
            }
        }

        // Aspose hook up
        protected override void OnHandleCreated(EventArgs e)
        {
            this.AllowDrop = true;
            this.asposeFileDropMgr = new Aspose.Windows.Forms.FileDropTargetManager(this);
            this.asposeFileDropMgr.EnsureRegistered(this);
            base.OnHandleCreated(e);
        }

        // Aspose unhook
        protected override void OnHandleDestroyed(EventArgs e)
        {
            this.asposeFileDropMgr.EnsureUnRegistered(this);
            base.OnHandleDestroyed(e);
        }

        protected override void OnDragDrop(DragEventArgs drgevent)
        {
            Aspose.Windows.Forms.FileDragEventArgs fde = drgevent as Aspose.Windows.Forms.FileDragEventArgs;
            if (fde == null)
            {
                return;
            }
            if ((fde.Effect &= DragDropEffects.Copy) != DragDropEffects.Copy)
            {
                return;
            }

            HandleApplicationDragDrop(fde);
        }
    }
}


Viewing all articles
Browse latest Browse all 1367

Latest Images

Trending Articles



Latest Images