刀剑如梦提供的源码与netcore提供的一样。
------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
shdocvw, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
log: TMemo;
Button2: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i: integer;
vi: OleVariant;
IE1: IWebBrowser2; //IE这里是源代码:
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
for i := 0 to nCount - 1 do
begin
vi := i;
try
spDisp := ShellWindow.Item(vi);
except exit end;
if (spDisp<>nil) then
begin
try
begin
spDisp.QueryInterface( iWebBrowser2, IE1 );
end
except
on EAccessViolation do begin exit end;
end;
if (IE1 <> nil) then
begin
Log.Lines.add( IE1.Get_LocationURL());
end;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
form1:=nil;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
form1.Button1Click(sender);
end;
end.