Autor Beitrag
pigfacejoe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 332
Erhaltene Danke: 1

Win 10, Ubuntu
Delphi,Javascript, PHP, Java, Python
BeitragVerfasst: Sa 21.07.07 09:02 
Guten Morgen!

Ich möchte gerne die URLs aus dem Favoritenverzeichnis (C:\Dokumente und Einstellungen\FitzeHitze\Favoriten) mit der IdHTTP Komponente öffnen und prüfen, ob die URLs erreichbar sind. Wie komme ich denn jetzt an die Internet Adresse ran?

Gruss
PigfaceJoe
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Sa 21.07.07 11:58 
Hallo,

da gehts weiter :arrow:
dsdt: Favoriten auslesen

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
pigfacejoe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 332
Erhaltene Danke: 1

Win 10, Ubuntu
Delphi,Javascript, PHP, Java, Python
BeitragVerfasst: Sa 21.07.07 19:48 
Danke, genau das brauche ich, allerdings sehe ich nix in der ListView (hab noch n ie mit der gearbeitet, wahrscheinlich irgend ein dummer Fehler^^)
Hier mal der gesamte Code:

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:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,ActiveX, StdCtrls,Shellapi,shlobj, IdBaseComponent, IdComponent,
  IdTCPConnection, IdTCPClient, IdHTTP,inifiles, ComCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    IdHTTP1: TIdHTTP;
    ListView1: TListView;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

procedure GetFilesInDirectory(ADirectory: string; AMask: String; AList: TStrings; ARekursiv: Boolean);
var
  SR: TSearchRec;
begin
  if (ADirectory<>'') and (ADirectory[length(ADirectory)]<>'\') then
    ADirectory:=ADirectory+'\';

  if (FindFirst(ADirectory+AMask,faAnyFile-faDirectory,SR)=0) then begin
    repeat
      if (SR.Name<>'.') and (SR.Name<>'..') and (SR.Attr<>faDirectory) then
          AList.Add(ADirectory+SR.Name)
    until FindNext(SR)<>0;
    FindClose(SR);
  end;

  if ARekursiv then
    if (FindFirst(ADirectory+'*.*',faDirectory,SR)=0) then
    begin
      repeat
        if (SR.Name<>'.') and (SR.Name<>'..') then
          GetFilesInDirectory(ADirectory+SR.Name,AMask,AList,True);
      until FindNext(SR)<>0;
      FindClose(SR);
    end;
end;
Procedure GetFavUrls(UrlList: TListItems);

 Function GetFavPath: string;
 var
  FavPath : Array[0..MAX_PATH] of Char;
  FavItem : PItemIdList;
 begin
   SHGetSpecialFolderLocation(Form1.Handle, CSIDL_FAVORITES , FavItem);
   SHGetPathFromIDList(FavItem, FavPath);
   result := FavPath;
 end;

 Function GetUrl(s: string): string;
 var
  ini: TInifile;
 begin
  ini := TIniFile.create(s);
  try
    result := ini.ReadString('InternetShortcut', 'URL', '');
  finally
   ini.free;
  end;
 end;

 Procedure GetFavUrlPath(Folder: String);
 var
  SR : TSearchRec;
 begin
  If Folder[length(Folder)] <> '\' then
   Folder := Folder + '\';
  If FindFirst(Folder + '*.Url', faAnyFile or faDirectory, SR) = 0 then
  try
    repeat
      If (SR.Name <> '.') and (SR.Name <> '..') and (SR.Attr <> faDirectory) then
       with UrlList.add do
       begin
         Caption := (copy(SR.name,1,pos('.url',Sr.Name) - 1));
         SubItems.add(GetUrl(Folder + Sr.Name));
       end;
    until FindNext (SR) <> 0;
  finally
   FindClose(SR);
  end;
  If FindFirst(Folder + '*.*', faDirectory, SR) = 0 then
  try
    repeat
      If (SR.Name <> '.') and (SR.Name <> '..') and (SR.Attr = faDirectory) then
       GetFavUrlPath(Folder + SR.Name);
    until FindNext (SR) <> 0;
  finally
   FindClose(SR);
  end; 
end;
begin
  GetFavUrlPath(GetFavPath);
end;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  GetFavUrls(ListView1.Items)
end;

end.


Hab die ListView Eigenschaft ViewStyle auf vsReport und sonst nix geändert!

Gruss PigfaceJoe
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Sa 21.07.07 21:08 
Hallo,

vermute das Du die Spalten in ListView.Columns nicht eingerichtet hast.
user profile icondsdt hat folgendes geschrieben:

Bemerke: Das ListView muss 2 Spalten haben. Am Besten stellst du die Eigenschaft ViewStyle auf vsReport, damit die Spalten auch zu sehen sind.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
pigfacejoe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 332
Erhaltene Danke: 1

Win 10, Ubuntu
Delphi,Javascript, PHP, Java, Python
BeitragVerfasst: Sa 21.07.07 21:20 
Hi Lannes,
Vielen Dank, genau das war mein problem!

Gute Nacht
Pigface Joe