Autor Beitrag
DELPHIn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Windows Vista
Delphi 2007 für Win 32 Prof.
BeitragVerfasst: Fr 06.05.05 15:57 
Hallo,

ich bin gerade dabei eine Link-Verwaltung zu schreiben und möchte nun die URL einer Webseite auslesen, die in einem geöffneten Fensters des FireFox-Browsers angezeigt wird.
Das habe ich bei einem anderen Programm gesehen und es macht mich verrückt, dass ichs nicht gecodet bekomme.

1. Ermitteln des Fensterhandles:
Mit FindWindowByTitle('Mozilla Firefox') komme ich nicht so recht weiter, da der Fenstertitel sich ständig ändert :( .

2. Auslesen der URL:
Da habe ich nun keine Ahnung und Google konnte auch nicht helfen :? .

Danke

_________________
DELPHIn
=> Errare humanum est
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Fr 06.05.05 17:35 
Hallo!

So funktionierts bei mir:

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:
uses
  ddeman;

procedure GetCurrentFirefoxURL(out URL, Title: string);
var
   DDEClient : TDDEClientConv;
   p, q: PChar;
   i: Integer;
begin
   DDEClient := TDDEClientConv.Create(nil);
   try
     with DDEClient do
       if SetLink('Firefox''WWW_GetWindowInfo'then
       p := RequestData('0xFFFFFFFF')
     else raise Exception.Create('Could not establish browser DDE link');
     if Assigned(p) then try
       q := p;
       Assert(q^ = '"');
       SetLength(URL, StrLen(q));
       Inc(q);
       i := 0;
       while q^ <> '"' do begin
         if (q^ = '\'and (q[1] = '"'then Inc(q);
         Inc(i);
         URL[i] := q^;
         Inc(q);
       end;
       SetLength(URL, i);
       SetLength(Title, StrLen(q));
       i := 0;
       Inc(q, 3);
       while q^ <> '"' do begin
         if (q^ = '\'and (q[1] = '"'then Inc(q);
         Inc(i);
         Title[i] := q^;
         Inc(q);
       end;
       SetLength(Title, i);
     finally
       StrDispose(p);
     end else raise Exception.Create('Could not fetch browser data');
   finally
     DDEClient.Free;
   end;
end;


Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
DELPHIn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Windows Vista
Delphi 2007 für Win 32 Prof.
BeitragVerfasst: Sa 07.05.05 10:57 
Danke, das hat sehr geholfen, endlich gehts.

Ich werde jetzt noch versuchen, alle geöffneten Fenster auszulesen.

Zitat:
So funktionierts bei mir:

Bist du dabei, ein ähnliches Programm zu schreiben?

_________________
DELPHIn
=> Errare humanum est
Terra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 307

Windows 7 Ultimate
Delphi® XE3
BeitragVerfasst: So 20.04.08 17:46 
Geht diese Function auch mit allen anderen Browsern ?

Terra
DELPHIn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Windows Vista
Delphi 2007 für Win 32 Prof.
BeitragVerfasst: Mo 21.04.08 13:32 
Nein, nur mit Browsern, die Lesezeichen verwenden (also Firefox, Mozilla, Netscape, u.A.), beim IE bzw. dem Opera muss man anderes rangehen.

_________________
DELPHIn
=> Errare humanum est