1 頁 (共 1 頁)

如何抓出在 TWebBrowser 中顯示網頁內用滑鼠選取的資料

發表於 : 2008年 11月 27日, 17:37
tim
可以利用 MSHtml 中的: IHTMLDocument2 及 IHTMLTxtRange
記得要使用 MSHtml 進來!!

代碼: 選擇全部

    procedure Tform1.Button2Click(Sender: TObject); 
    var 
      hd: IHTMLDocument2; 
      ht: IHTMLTxtRange; 
    begin 
      hd := webbrowser1.Document as IHTMLDocument2; 
      ht := hd.selection.createRange as IHTMLTxtRange; 
      showmessage(ht.text); 
    end;