第一个问题:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,tlhelp32, ExtCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure isclose;
end;var
Form1: TForm1;
i:integer;
implementationuses Unit2;{$R *.dfm}procedure TForm1.isclose;
begin
begin
try
timer1.Enabled:=false;
PasswordDlg:=TPasswordDlg.Create(application);
if PasswordDlg.ShowModal=mrok then
begin
if PasswordDlg.Password.Text='zxcvbnm' then exit
else
begin
inc(i);
timer1.Enabled:=true;
end;
end
else timer1.Enabled:=true;
finally
PasswordDlg.Free;
PasswordDlg:=nil;
end;
end;
end;procedure TForm1.Timer1Timer(Sender: TObject);
var
pr:tprocessentry32;
hand:thandle;
hd:hwnd;
found:boolean;
begin
form1.Hide;
hand:=createtoolhelp32snapshot(TH32CS_SNAPALL,0);
found:=process32first(hand,pr);
while found do
begin
if uppercase(extractfilename(pr.szExeFile))='IEXPLORE.EXE' then
begin
hd:=OpenProcess(PROCESS_ALL_ACCESS,true,pr.th32ProcessID);
TerminateProcess(hd,0);
if (i=0) or (i=1) then isclose;
end;
found:=process32next(hand,pr);
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;
end;end.unit Unit2;interfaceuses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons;type
TPasswordDlg = class(TForm)
Label1: TLabel;
Password: TEdit;
OKBtn: TButton; private
{ Private declarations }
public
{ Public declarations }
end; var
PasswordDlg: TPasswordDlg;implementation{$R *.dfm}end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,tlhelp32, ExtCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure isclose;
end;var
Form1: TForm1;
i:integer;
implementationuses Unit2;{$R *.dfm}procedure TForm1.isclose;
begin
begin
try
timer1.Enabled:=false;
PasswordDlg:=TPasswordDlg.Create(application);
if PasswordDlg.ShowModal=mrok then
begin
if PasswordDlg.Password.Text='zxcvbnm' then exit
else
begin
inc(i);
timer1.Enabled:=true;
end;
end
else timer1.Enabled:=true;
finally
PasswordDlg.Free;
PasswordDlg:=nil;
end;
end;
end;procedure TForm1.Timer1Timer(Sender: TObject);
var
pr:tprocessentry32;
hand:thandle;
hd:hwnd;
found:boolean;
begin
form1.Hide;
hand:=createtoolhelp32snapshot(TH32CS_SNAPALL,0);
found:=process32first(hand,pr);
while found do
begin
if uppercase(extractfilename(pr.szExeFile))='IEXPLORE.EXE' then
begin
hd:=OpenProcess(PROCESS_ALL_ACCESS,true,pr.th32ProcessID);
TerminateProcess(hd,0);
if (i=0) or (i=1) then isclose;
end;
found:=process32next(hand,pr);
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;
end;end.unit Unit2;interfaceuses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons;type
TPasswordDlg = class(TForm)
Label1: TLabel;
Password: TEdit;
OKBtn: TButton; private
{ Private declarations }
public
{ Public declarations }
end; var
PasswordDlg: TPasswordDlg;implementation{$R *.dfm}end.
FindFirst, FindNext...
你找找帮助,在帮助中有例子
不清楚,你可以查找类名为IEFrame的句柄,
如有就说明IE打开了