📄 ieform.pas
字号:
unit IEForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
SHDocVw, MSHTML, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ComboBox1: TComboBox;
procedure FormResize(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
IEThis: IWebbrowser2;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormResize(Sender: TObject);
begin
with Button1 do begin
Left := 0;
Top := 0;
Height := Self.ClientHeight;
end;
with ComboBox1 do begin
Left := Button1.Width + 3;
Top := 0;
Height := Self.ClientHeight;
Width := Self.ClientWidth - Left;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
doc: IHTMLDocument2;
all: IHTMLElementCollection;
len, i, flag: integer;
item: IHTMLElement;
vAttri: Variant;
begin
if Assigned(IEThis) then
begin
ComboBox1.Clear;
doc := IEThis.Document as IHTMLDocument2;
all := doc.Get_all;
len := all.Get_length;
for i := 0 to len - 1 do
begin
item := all.item(i, varempty) as IHTMLElement;
if ansicomparetext(item.Get_tagName , 'A')=0 then
begin
flag := 0;
vAttri := item.getAttribute('protocol', flag);
if ansicomparetext(vAttri , 'mailto:')=0 then
begin
vAttri := item.getAttribute('href', flag);
ComboBox1.Items.Add(vAttri);
end;
end;
end;
end;
if Combobox1.Items.Count>0 then Combobox1.ItemIndex:=0;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Combobox1.Clear;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -