TWebBrowser - Detecting the tag under caret
问题 I want to detect on which HTML tag (more exactly hyperlink) is the caret. procedure THTMLEdit.ShowTag; var CursorPos: TPoint; HtmlElement: IHTMLElement; iHTMLDoc: IHtmlDocument2; begin if Supports(wbBrowser.Document, IHtmlDocument2, iHTMLDoc) then begin if GetcaretPos(CursorPos) then begin CursorPos := wbBrowser.screentoclient(CursorPos); HtmlElement := iHTMLDoc.ElementFromPoint(CursorPos.X, CursorPos.Y); // I NEED KEYBOARD CARET HERE, NOT MOUSE CURSOR if HtmlElement <> NIL then label1