Pobieranie strony pod Synapse.

0

W jaki sposób można pobrać aktualnie otwarty adres www, storny internetowej ? z uzyciem synhttp(synapse)

0

Wyłuskaj adres strony z przeglądarki przy użyciu mechanizmu dde, przykłady masz w Google, a co do Synapse to
Obsługa protokołu HTTP przy użyciu pakietu Synapse i nie dawaj w tytułach Delphi. Od tego masz tagi.

0

mam taki kod:

procedure GetCurrentURL(out URL, Title: string);
var
   DDEClient : TDDEClientConv;
   p, q: PChar;
   i: Integer;
begin
   DDEClient := TDDEClientConv.Create(nil);
   try
     with DDEClient do if SetLink('IExplore', 'WWW_GetWindowInfo') or
       SetLink('Netscape', 'WWW_GetWindowInfo') or
       SetLink('Mosaic', 'WWW_GetWindowInfo') or
       SetLink('Netscp6', 'WWW_GetWindowInfo') or
       SetLink('Mozilla', 'WWW_GetWindowInfo') or
       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;

ewentualnie ten kod....

procedure TForm1.Button1Click(Sender: TObject);
var
  x: Integer;
  Sw: IShellWindows;
begin
  sw := CoShellWindows.Create;
  for x := 0 to SW.Count - 1 do
    Listbox1.Items.Add((Sw.Item(x) as IWebbrowser2).LocationUrl);
end;

jak wywołać "pobraną stronę" w tym warunku?

    if Pos('http://mojastrona.pl/forum/post-',  TUTAJ_POBRANA_STRONA_Z_DDE) > 0 then
0
const
  PAGE_URL = 'http://4programmers.net/Forum/';
var
  url, title: string;
begin
  GetCurrentURL(url, title);
  if Pos(PAGE_URL, url) = 1 then
     ShowMessage('Adres strony zaczyna się od ' + PAGE_URL);
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1