Autor Beitrag
Baumunk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 50

WinXP
Delphi 2005
BeitragVerfasst: Mo 24.07.06 09:21 
Hallo zusammen,

Ich versuche gerade letzter schlief für meine Programm zu machen und brache dafür Drag & Drop Funktion mit Outlook.
Damit benutzer Email's in das Programm ziehen und verwen kann. Dafür verwende ich Interface IDropTarget.

In der Function Drop schreibe so:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
function Drop(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint;
  var dwEffect: Longint): HResult;
Var
  file_group_descriptor : PFileGroupDescriptor;
  file_descroptor       : TFileDescriptor;
  descriptor_Format     : TFormatETC;
  contents_format       : TFormatETC;
  CF_FORMAT_DESCRIPTOR  : UINT;
  CF_FORMAT_contents    : UINT;
  hr                    : HRESULT;
  Medium                : TSTGMedium;
  I                     : Integer;
  Mem                   : TMemoryStream;
  {----------------------------------------------------------------------------}
  Function StreamToMemoryStream (Stream : IStream; Mem : TMemoryStream) : HResult;
  Var Buffer : Array [0..65535] of Byte;
      Bytes_Readed : LongInt;
      HR           : HRESULT;
  Begin
    Mem.Size := 0;
    Stream.Read(@Buffer[0], SizeOf (Byte), @Bytes_Readed);
    While (HR = S_OK) And (Bytes_Readed > 0) Do Begin
      Mem.Write(Buffer, Bytes_Readed);
    End;
  End;
  {----------------------------------------------------------------------------}
Begin
  CF_FORMAT_DESCRIPTOR  := RegisterClipboardFormat (CFSTR_FILEDESCRIPTOR);
  CF_FORMAT_contents    := RegisterClipboardFormat (CFSTR_FILECONTENTS);

  descriptor_format.cfFormat := CF_FORMAT_DESCRIPTOR;
  descriptor_format.ptd      := Nil;
  descriptor_format.dwAspect := DVASPECT_CONTENT;
  descriptor_format.lindex   := -1;
  descriptor_format.tymed    := TYMED_HGLOBAL;

  contents_format.cfFormat   := CF_FORMAT_contents;
  contents_format.ptd        := Nil;
  contents_format.dwAspect   := DVASPECT_CONTENT;
  contents_format.lindex     := -1;
  contents_format.tymed      := TYMED_ISTREAM;

  hr := dataObj.QueryGetData(descriptor_format);
  OleCheck (dataObj.QueryGetData(descriptor_format));
  if hr = S_OK Then Begin
    hr := dataObj.QueryGetData(contents_format);
    If hr = S_OK Then Begin
      FillChar (Medium, SizeOf (Medium), 0);
      hr := DataObj.GetData(descriptor_format, medium);
      file_group_descriptor := GlobalLock (Medium.hGlobal);
      Mem                   := TMemoryStream.Create;
      For I := 0 to File_Group_Descriptor^.cItems - 1 Do Begin
        file_descroptor := File_Group_Descriptor^.fgd [I];
        FillChar (medium, SizeOf (Medium), 0);

        contents_format.cfFormat   := CF_FORMAT_contents;
        contents_format.ptd        := Nil;
        contents_format.dwAspect   := DVASPECT_CONTENT;
        contents_format.lIndex     := I;
        contents_format.tymed      := TYMED_ISTREAM;

        OleCheck (dataObj.GetData(contents_format, medium)); { Stelle 1 }
        If hr = S_OK Then Begin
          FOwnerForm.ListBox1.Items.Add (file_descroptor.cFileName);
          Hr := StreamToMemoryStream (IStream (medium.stm), Mem);
          Mem.SaveToFile(Format ('C:\D_D\Text%d.msg',[I]));
        End;
      End;
      Mem.Free;
      GlobalUnlock (Medium.hGlobal);
      GlobalFree (Medium.hGlobal);
    End;
  End;
End;


an der stelle wo ich versuche EMail als Stream zu bekommen (Stelle 1) kriege ich Exception EOLESysError "Falscher Parameter"

Was kann ich da falsch eingegeben haben.

Voraus danke
Baumunk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 50

WinXP
Delphi 2005
BeitragVerfasst: Mo 31.07.06 11:22 
Hallo,

hat wirklich keiner eine Lösung?
strider
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Do 23.11.06 14:45 
Hi,

Ich habe die genau ähnlich Problem.

Hat wirklich niemand schon ein Rettung gefunden?
Bitte?

Jemand?

Danke,
Strider