SHARE
TWEET

Untitled

a guest Jan 20th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var th = new Thread(() =>
  2.             {
  3.                 using (var br = new WebBrowser())
  4.                 {
  5.                     br.DocumentCompleted += browser_DocumentCompleted;
  6.  
  7.                     br.ScriptErrorsSuppressed = true;
  8.                     br.ScrollBarsEnabled = true;
  9.                     br.AllowNavigation = true;
  10.  
  11.                     br.Navigate(urltoRun);
  12.                     Application.Run();
  13.                 }
  14.             });
  15.             th.SetApartmentState(ApartmentState.STA);
  16.             th.Start();
  17.             th.Join(60000);
  18.             th = null;
  19.    
  20. private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  21.     {
  22.         if (!string.IsNullOrEmpty(htmlResult))
  23.             return;
  24.     // DO SOMETHING...
  25.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top