GroupWise의 이메일 파일 첨부 파일에서 .NET 응용 프로그램으로 드래그 앤 드래그 앤 드롭

StackOverflow https://stackoverflow.com/questions/896197

문제

Novell Groupwise의 이메일 열린 첨부 파일을 C# Winforms 응용 프로그램에 삭제하도록하려고합니다. 표준 .NET 기능이 작동하지 않습니다.

컨트롤의 드래그 드롭 이벤트에서 e.data.getformats ()는 다음을 반환합니다.

FileGroupDescriptorW
FileGroupDescriptor
FileContents
attachment format

e.data.getData ( "FileGroupDescriptor")와 함께 파일 이름을 얻을 수 있고 76 위치로 이동할 수 있습니다.

불행히도, e.data.getData ( "FileContents")는 System.Windows.Forms.dll에서 NOTIMPLEMENTEDEXCELCESTION을 유발하고 NULL을 반환합니다. 첨부 형식도 NULL을 반환합니다.

내 검색에 따르면 드래그 앤 드롭은 내가 생각했던 것보다 훨씬 더 복잡하다고 말합니다. :) GroupSise는 CFSTR_FILECONTENTS라는 형식을 사용하는 것처럼 보이지만 그것은 단지 추측 일뿐입니다. 첨부 파일을 Windows 데스크탑 또는 기타 폴더로 성공적으로 드래그하여 떨어 뜨릴 수 있습니다.

제안 해주셔서 감사합니다.

도움이 되었습니까?

해결책

나는 이것을 찾는 운이 없었습니다. 다음은 내가 생각해 낸 것 (Groupwise 7)입니다.

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);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top