Link to home
Start Free TrialLog in
Avatar of cels9
cels9

asked on

IE's URL APP

I need one app that when the person views one site in IE, save the adress of the page in one .txt.
tnx
Avatar of Evarest
Evarest

This will get the URL of the currently active IExplorer

 function Get_URL(Servicio: string): String;
                  var
                    Cliente_DDE: TDDEClientConv;
                  begin
                    Result := '';
                    Cliente_DDE:= TDDEClientConv.Create( nil );
                    with Cliente_DDE do
                      begin
                        SetLink( Servicio,'WWW_GetWindowInfo');
                        Result := StrPas(RequestData('0xFFFFFFFF'));
                        CloseLink;
                      end;
                    Cliente_DDE.Free;
                  end;

procedure TForm1.Button1Click(Sender);
begin
 Memo1.Lines.Add( Get_URL('IExplore') );
 // or for Netscape:
 Memo1.Lines.Add( Get_URL('Netscape') );
end;

You can of course set this function in a Timer and check every x msec whether the URL has changed (new window/new url)...

Good luck!
Evarest
ASKER CERTIFIED SOLUTION
Avatar of Ivanov_G
Ivanov_G
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eddie Shipman
This will get the URL of EVERY currently open instance of IE, even the ones that are minimized or hidden (not shown):

procedure TForm1.Button1Click
  ( ASender:                   TObject
  );
var
  ShellWin : TShellWindows;
  i : integer;
  IE : IWebBrowser2;
begin
  ShellWin := TShellWindows.Create(nil);
  try
    for i := 0 to ShellWin.Count-1 do
      begin
        try
          ShellWin.Item(i).QueryInterface(IID_IWebBrowser2, IE);
          Memo1.Lines.Add( IE.LocationName + '->' + IE.LocationURL);
        except
        end;
      end;
  finally
    ShellWin.Free;
  end;
end;