TLama

Untitled

Feb 26th, 2014
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.97 KB | None | 0 0
  1. uses
  2.   ComObj;
  3.  
  4. procedure TForm1.Button1Click(Sender: TObject);
  5. var
  6.   I, J: Integer;
  7.   Document: OleVariant;
  8.   ShellWindows: OleVariant;
  9.   ShellApplication: OleVariant;
  10.   InternetExplorer: OleVariant;
  11. begin
  12.   ShellApplication := CreateOleObject('Shell.Application');
  13.   if not VarIsEmpty(ShellApplication) then
  14.   begin
  15.     ShellWindows := ShellApplication.Windows;
  16.     for I := 0 to ShellWindows.Count - 1 do
  17.     begin
  18.       InternetExplorer := ShellWindows.Item(I);
  19.       if UpperCase(ExtractFileName(InternetExplorer.FullName)) = 'IEXPLORE.EXE' then
  20.       begin
  21.         Document := InternetExplorer.Document;
  22.         if not VarIsEmpty(Document) then
  23.         begin
  24.           Memo1.Lines.BeginUpdate;
  25.           try
  26.             for J := 0 to Document.links.length - 1 do
  27.               Memo1.Lines.Add(Document.links.item(I).href);
  28.           finally
  29.             Memo1.Lines.EndUpdate;
  30.           end;
  31.         end;
  32.         Exit;
  33.       end;
  34.     end;
  35.   end;
  36. end;
Advertisement
Add Comment
Please, Sign In to add comment