Ver Mensaje Individual
  #1  
Antiguo 16-02-2010
izia izia is offline
Registrado
 
Registrado: feb 2010
Posts: 8
Reputación: 0
izia Va por buen camino
Drag and Drop con archivo adjunto de outlook

Hola!
Tengo un problema con delphi. Quiero poder subir ficheros adjuntos a emails de outlook arrastrándolos a un listbox para subirlos a una base de datos. He estado mirando drag and drop, pero no consigo que funcione con ficheros adjuntos en outlook.
He buscado por google pero no encuentro código para delphi, he encontrado en visualbasic. Pero no lo tengo muy claro para "traducirlo", y si se puede...
¿Álguien sabe hacerlo?

El código en visual es este, por si alguien si tiene idea de como hacerlo:
Cita:
Private Sub Form1_DragEnter(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
e.Effect = DragDropEffects.Copy
End Sub

Private Sub Form1_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop

Dim memoryStream As System.IO.MemoryStream =
e.Data.GetData("FileGroupDescriptor")
'Sets the position within the current stream to the beginning of the
file name.
memoryStream.Seek(76, IO.SeekOrigin.Begin)

Dim fileName As Byte() = New Byte(256) {}
'return the file name in the fileName variable
memoryStream.Read(fileName, 0, 256)

Dim encoding As System.Text.Encoding = System.Text.Encoding.ASCII
'convert to byte arry to string
Dim strFileName As String = encoding.GetString(fileName)
'trim the strFileName to get the correct file name
strFileName = strFileName.TrimEnd("")

memoryStream = e.Data.GetData("FileContents")
'write the file content to a file under the same path of the exe file.
Dim fs As New IO.FileStream(strFileName, IO.FileMode.Create)
memoryStream.WriteTo(fs)
fs.Close()

End Sub
Y lo he sacado de:
##w#w#w#.devnewsgroups.#net/#group/microsoft.#public.dotnet.framework.windowsforms/topic46776.#aspx

sin las almohadillas
Responder Con Cita