Powiadomienia
Wyczyść wszystko
BugOverflow
1
Wpisy
1
Użytkownicy
0
Reactions
1,343
Widoki
0
12/01/2020 5:06 pm
Rozpoczynający temat
detect mouse click on link, a href
1 odpowiedź
0
12/01/2020 5:07 pm
Rozpoczynający temat
private void web_LoadCompleted(object sender, NavigationEventArgs e)
{
//web - name of webbrowser component
HTMLDocument doc = (HTMLDocument)web.Document;
HTMLDocumentEvents2_Event htmlEvents = (HTMLDocumentEvents2_Event)doc;
htmlEvents.onclick += new HTMLDocumentEvents2_onclickEventHandler(htmlEvents_onclick);
}
private bool htmlEvents_onclick(IHTMLEventObj pEvtObj)
{
var html_element = (pEvtObj.srcElement as IHTMLElement);
var html_ahref = (html_element as IHTMLAnchorElement);
try
{
MessageBox.Show(html_ahref.href);
}
catch (Exception)
{ }
return true;
}
