function CallBackProc(H, HMainForm: hwnd): Boolean; stdcall; var
hChild : hwnd; begin Result := True; if GetParent(H) = HMainForm
then begin //可以在這里進一步判斷類名,以免關(guān)掉其他彈出窗口 hChild := FindWindowEx(H, 0,
PChar('Button'), PChar('確定')); if hChild > 0 then SendMessage(hChild,
BM_Click, 0, 0); end; end;
procedure TForm1.Timer1Timer(Sender:
TObject); begin EnumWindows(@CallBackProc,
Self.Handle); end;
procedure TForm1.Button1Click(Sender:
TObject); begin Self.WebBrowser1.Navigate('C:\Documents and
Settings\jiaotongju\桌面\test2\test.htm'); end;
procedure
TForm1.Button2Click(Sender: TObject); begin Self.Timer1.Enabled :=
True;//Web頁面裝載完畢后開啟Timer end;
procedure TForm1.FormCreate(Sender:
TObject); begin Self.Timer1.Enabled := False;
Self.Timer1.Interval:= 100; end;
|