Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

How to set the focus on a TWebbrowser

Title: How to set the focus on a TWebbrowser 1} uses ActiveX; begin WebBrowser1.Navigate('irgendeinedatei.html'); with WebBrowser1 do if Document nil then with Application as IOleobject do DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser1, 0, Handle, GetClientRect); end; {2} uses MSHTML; begin WebBrowser1.Navigate('irgendeinedatei.html'); repeat Application.ProcessMessages; until WebBrowser1.ReadyState = READYSTATE_COMPLETE; if WebBrowser1.Document nil then (Webbrowser1.Document as IHTMLDocument2).ParentWindow.Focus; end;