Autor Beitrag
vader
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Fr 09.04.04 05:59 
hab folgenden funktion, diese zeigt mir das c:\ laufwerk
in einen treeview an.
diese funktion lasse ich am serverrechner vom client aus
ausführen.

jetzt die große frage am server wird das laufwerk c im treeview
angezeigt, aber wie kann ich das zum client bringen bzw senden.

Code:

ausblenden volle Höhe 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:
type 
  pNodeInfo = ^tNodeInfo; 
  tNodeInfo = record 
      Path: Boolean; 
      Name: String; 
    end; 

Procedure FindFilesTree (aTree: tTreeView; aPath: String; aNode: tTreeNode; aWithFiles: Boolean); 
Var 
  SearchRec: tSearchRec; 
  NodeTmp: tTreeNode; 
  Info: pNodeInfo; 
Begin 
  aTree.Items.BeginUpdate; 

  // Wenn am Ende der Pfadangabe noch kein \ steht, dieses hinzufügen 
  If aPath [Length (aPath)] <> '\' Then 
    aPath := aPath + '\'; 

  If FindFirst (aPath + '*.*', faDirectory, SearchRec) = 0 Then 
    Begin 
      Repeat 
        // Wenn es sich um ein Verzeichnis handelt 
        If (SearchRec.Attr and faDirectory = faDirectory) 
          and (SearchRec.Name[1] <> '.') 
        Then 
          Begin 
            If (SearchRec.Attr and faDirectory > 0) then 
              Begin 
                New (Info); 
                Info^.Path := True; 
                Info^.Name := aPath + SearchRec.Name; 

                // zum aktuellen Eintrag hinzufügen 
                aNode := aTree.Items.AddChildObject (aNode, SearchRec.Name, Info); 
              End; 

            // Eintrag merken 
            NodeTmp := aNode.Parent; 
            // auf Untereinträge prüfen 
            FindFilesTree (aTree, aPath + SearchRec.Name, aNode, aWithFiles); 
            // Eintrag wiederholen 
            aNode := NodeTmp; 
          End 
        Else 
          // Eintrag ist eine Datei 
          If aWithFiles 
            and (SearchRec.Name <> '.') and (SearchRec.Name <> '..') 
          Then 
            Begin 
              New (Info); 
              Info^.Path := False; 
              Info^.Name := aPath + SearchRec.Name; 

              aTree.Items.AddChildObject (aNode, SearchRec.Name, Info); 
            End; 

      // solange weiter bis keine wieteren Dateien/Verzeichniss gefunden werden 
      Until FindNext (SearchRec) <> 0; 

      FindClose (SearchRec); 
    End; 

  aTree.Items.EndUpdate; 
End;



es gibt die methode savetofile() für treeview aber ich weiß nicht wie ich das coden soll ?? :?


mfg vader
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 09.04.04 09:55 
ja wen du die methode savetofile aufrufst, dann speichert der treeview seinen tree in eine daetei. mach das soch einfach und übertrage dann die datei auf den client.
eleganter ohne umweg über ne datei geht das mit savetostream.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
vader Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Fr 09.04.04 10:49 
hallo matze,

kannst du mir ein bißchen code posten wie ich die methode savetofile aufrufe, und mit savetostream sende.

mfg vader
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 10.04.04 09:34 
also ich gehe mal davon aus, dass du weissz wie du mit deinem server eine datei für die clients zum download bereitsellt.
machen wir es der einfachheit halber mal mit savetofie.
mach doch einfach:
treeview1.SaveToFile ('c:\treeview.txt');diese datei stellt der server dann für die clients berei. die laden sich die datei und rufen dann loadfromfile auf.

_________________
In the beginning was the word.
And the word was content-type: text/plain.