Autor Beitrag
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 24.02.06 14:13 
ich möcht das wenn man eine Datei in ein Programm verschiebt das sich das Dokument öffnen (Word). Wie mach ich das?

mfg el
frank-wob
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 24.02.06 14:16 
Ich hab keinen Schimmer was du meinst.... Könntest du deine Frage etwas Präziser stellen.

Frank
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 24.02.06 14:19 
ok!

also: Man hat eine Datei am Desktop. Ich ruf mein "Supertolles, Weltbewegendes" Selbstgeschriebenes Textverarbeitungsprogramm auf. Ich zieh die Datei auf das Formular und jetzt sollte es sich in dem Formular öffnen!!

alles klar??
LLCoolDave
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 212

Win XP
Delphi 2005
BeitragVerfasst: Fr 24.02.06 14:25 
www.delphi-library.de/viewtopic.php?t=5286

Musst du dann nur noch für dich entsprechend anpassen.
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 24.02.06 14:28 
ich versteh davon genau null!!!! wer kanns mir übersetzen und erklären?? bitte!!
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Fr 24.02.06 14:34 
ich denke, du meinst Drag and Drop.
Vielleicht könnte dir das hier helfen:
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:
uses ShellApi;

...

  private
    { Private-Deklarationen }
    procedure WMDROPFILES (var Msg: TMessage); message WM_DROPFILES;

...

procedure TForm1.WMDROPFILES (var Msg: TMessage);
var i, anzahl, size: integer;
  Dateiname: PChar;
begin
  inherited;
  anzahl := DragQueryFile(Msg.WParam, $FFFFFFFF, Dateiname, 255);
  for i := 0 to (anzahl - 1) do
  begin
    size := DragQueryFile(Msg.WParam, i , nil, 0) + 1;
    Dateiname:= StrAlloc(size);
    DragQueryFile(Msg.WParam,i , Dateiname, size);
    //ListBox1.items.add(StrPas(Dateiname)); hierher, was mit der Datei gemacht werden soll
    StrDispose(Dateiname);
  end;
  DragFinish(Msg.WParam);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(Form1.Handle, true);
  ...
end;


Das ist eigentlich genau das selbe, worauf LLCollDave schon hingewiesen hat.. :roll:
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 24.02.06 14:37 
aba ich versteh das nicht wie ich das mim richedit machen soll!!
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Fr 24.02.06 14:40 
user profile iconelundril hat folgendes geschrieben:
aba ich versteh das nicht wie ich das mim richedit machen soll!!

Willst du, dass immer nur eine Datei geöffnet wird, auch wenn mehrere auf dein Formular gezogen wurden?
//Sollte gehen

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:
uses
ShellApi...


  protected
    Procedure WMDropFiles (Var aMsg: tMessage);  message WM_DROPFILES;

...

Procedure TForm1.WMDropFiles(Var aMsg: tMessage);
Var
  Idx,
  Size,
  FileCount: Integer;
  Filename: pChar;
Begin
  Inherited;

  FileCount := DragQueryFile (aMsg.WParam, $FFFFFFFF, nil, 255);
  For Idx := 0 To FileCount -1 Do
    Begin
      Size := DragQueryFile (aMsg.WParam, Idx, nil, 0) + 1;
      Filename := StrAlloc (Size);
      
       If DragQueryFile (aMsg.WParam, Idx, Filename, Size) = 1 Then
        { nothing } ;

      Richedit1.Lines.LoadFromFile(pChar(Filename));
      StrDispose(Filename);
    End;

  DragFinish (aMsg.WParam);
End;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(Form1.Handle, true);
end;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 24.02.06 17:25 
@Danniolo:
ausblenden Delphi-Quelltext
1:
2:
If DragQueryFile (aMsg.WParam, Idx, Filename, Size) = 1 Then  
        { nothing } ;

Das ist jetzt nicht dein Ernst oder? :mrgreen: Siehe dazu Suche im MSDN DRAGQUERYFILE.