codefinger
asked on
recognizing a file drop from Groupwise
I want the users to be able to open a Groupwise email and drag a file attachment on to a list box in my winforms application. The application recognizes what has happened and takes possession of the file, or a copy of it, for further processing.
How can this be done?
Thanks.
How can this be done?
Thanks.
ASKER
By "list box in my winforms application", I mean the application I am coding.
According to my Googling, the code attached below MAY do what I need, but it is in VC.Net where I have no skill. If some one could re-write it in VB.NET, and it works, that will be my solution.
According to my Googling, the code attached below MAY do what I need, but it is in VC.Net where I have no skill. If some one could re-write it in VB.NET, and it works, that will be my solution.
private void control_DragDrop(object sender, DragEventArgs e)
{
string strFilename = null;
//something about the act of reading this stream creates the file in your temp folder(?)
using (MemoryStream stream = (MemoryStream)e.Data.GetData("attachment format", true))
{
byte[] b = new byte[stream.Length];
stream.Read(b, 0, (int)stream.Length);
strFilename = Encoding.Unicode.GetString(b);
//The path/filename is at position 10.
strFilename = strFilename.Substring(10, strFilename.IndexOf('\0', 10) - 10);
stream.Close();
}
if (strFilename != null && File.Exists(strFilename))
{
//From here on out, you're just reading another file from the disk...
using(FileStream fileIn = File.Open(strFilename, FileMode.Open))
{
//Do your thing
fileIn.Close();
}
}
File.Delete(strFilename);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm not sure what you mean by "list box in my winforms application". Perhaps you have a screen capture of the list box?
Scott