2020国产成人精品视频,性做久久久久久久久,亚洲国产成人久久综合一区,亚洲影院天堂中文av色

分享

關(guān)于delphiwebbrowser二次點(diǎn)擊來(lái)路問(wèn)題

 sumstars 2014-11-19

webbrowser二次點(diǎn)擊webb可以實(shí)現(xiàn)二次點(diǎn)擊但是二次點(diǎn)擊的來(lái)路為空。這里先說(shuō)明一下為什么是沒(méi)有來(lái)路的。
二次點(diǎn)擊的代碼本質(zhì)是2個(gè)內(nèi)置瀏覽器webbrowser,webb1點(diǎn)擊的網(wǎng)頁(yè)的時(shí)候把新打開(kāi)的網(wǎng)頁(yè)地址賦值給webb2去打開(kāi)。就相當(dāng)于webb是從新打開(kāi)了一個(gè)新的地址,來(lái)路當(dāng)然是空的。下面的代碼附上解決的辦法。

代碼比較長(zhǎng) 我把關(guān)鍵的地方標(biāo)注一下
var
  curUrl:string;///定義的地址變量
implementation
{$R *.dfm}
procedure TForm1.EmbeddedWB1NewWindow3(ASender: TObject;
  var ppDisp: IDispatch; var Cancel: WordBool; dwFlags: Cardinal;
  const bstrUrlContext, bstrUrl: WideString);
begin
  Cancel := True;
  curUrl:=bstrUrl;///這里是解決2次來(lái)路不統(tǒng)一的地方
  self.Timer12.Interval:=100;
  self.Timer12.Enabled:=true;
end;

procedure TForm1.Timer12Timer(Sender: TObject);
begin
  self.Timer12.Enabled:=false;
  MyNavigate (curUrl);////這里比較關(guān)鍵
end;

procedure TForm1.Button3Click(Sender: TObject);
begin

 DelCookie;
  DeleteIECache;
swzjl := EmbeddedWB1.LocationURL;
  if swzjl <> swz then
  begin
    timer5.Enabled := true;
  end;
  if swzjl = swz then
  begin
    timer6.Enabled := true;
  end;
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
  self.Timer11.Enabled:=true;
  self.Timer13.Interval:=5000;  //停留等鼠標(biāo)移動(dòng)幾秒后,開(kāi)始點(diǎn)擊///////////////////////////////////////////////////////////////
  self.Timer13.Enabled:=true;
end;

procedure TForm1.MyNavigate(url: string);
var
  Flags, Headers, TargetFrameName, PostData: OLEVariant;
begin
  Flags := ”;
  TargetFrameName := ”;
  PostData := ”;
  EmbeddedWB1.Stop;//這是設(shè)置來(lái)路的函數(shù)
  Headers := ‘Referer:’+self.EmbeddedWB1.LocationURL+#10#13;
  EmbeddedWB1.Navigate(url,Flags, TargetFrameName, PostData, Headers);
end;

procedure TForm1.CloseSound;
var
  hDSound: Cardinal;
  pDirectSoundCreate: Pointer;
  hWinmm: Cardinal;
  pmidiStreamOpen: Pointer;
  pwaveOutWrite: Pointer;
  lp: Cardinal;
begin
  try
    hDSound := LoadLibrary(‘DSound.dll’);
    if hDSound > 0 then
      pDirectSoundCreate := GetProcAddress(hDSound, ‘DirectSoundCreate’);
    if pDirectSoundCreate <> nil then
    begin
      VirtualProtect(pDirectSoundCreate, 3, PAGE_EXECUTE_READWRITE, lp);
      Move(#$C2#$0C#$00, pDirectSoundCreate^, 3);
    end;

    hWinmm := LoadLibrary(‘Winmm.dll’);
    if hWinmm > 0 then
      pmidiStreamOpen := GetProcAddress(hWinmm, ‘midiStreamOpen’);
    if pmidiStreamOpen <> nil then
    begin
      VirtualProtect(pmidiStreamOpen, 3, PAGE_EXECUTE_READWRITE, lp);
      Move(#$C2#$04#$00, pmidiStreamOpen^, 3);
    end;

    if hWinmm > 0 then
      pwaveOutWrite := GetProcAddress(hWinmm, ‘waveOutWrite’);
    if pwaveOutWrite <> nil then
    begin
      VirtualProtect(pwaveOutWrite, 3, PAGE_EXECUTE_READWRITE, lp);
      Move(#$C2#$0C#$00, pwaveOutWrite^, 3);
    end;
  except
  end;
end;

procedure TForm1.EmbeddedWB1NavigateComplete2(ASender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
var
  Doc2:IHTMLDocument2;
begin
  Doc2:=EmbeddedWB1.Document as IHTMLDocument2;
  Doc2.parentWindow.execScript(‘function open(){return;}’,'Javascript’);
  Doc2.parentWindow.execScript(‘function alert(){return;}’,'Javascript’);
  Doc2.parentWindow.execScript(‘function confirm(){return;}’,'Javascript’);
  Doc2.parentWindow.execScript(‘function showModalDialog(){return;}’,'Javascript’);
  Doc2.parentWindow.execScript(‘function attachEvent(){return;}’,'Javascript’); //禁止動(dòng)態(tài)添加事件
  Doc2.parentWindow.execScript(‘function document.createElement(){return;}’,'Javascript’);//禁止動(dòng)態(tài)創(chuàng)建
end;
function TForm1.EmbeddedWB1ShowMessage(Sender: TObject; HWND: Cardinal;
  lpstrText, lpstrCaption: PWideChar; dwType: Integer;
  lpstrHelpFile: PWideChar; dwHelpContext: Integer;
  var plResult: Integer): HRESULT;
begin
  result:=s_OK;     //禁止彈出各種腳本對(duì)話框
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
  //self.EmbeddedWB1.Navigate(‘http://www./html/ribenrentiyishu/200912/03-1095.html’);
self.EmbeddedWB1.Navigate(‘http://180.123.89.103/’);
  DeleteIECache;
end;

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多