Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var th = new Thread(() =>
- {
- using (var br = new WebBrowser())
- {
- br.DocumentCompleted += browser_DocumentCompleted;
- br.ScriptErrorsSuppressed = true;
- br.ScrollBarsEnabled = true;
- br.AllowNavigation = true;
- br.Navigate(urltoRun);
- Application.Run();
- }
- });
- th.SetApartmentState(ApartmentState.STA);
- th.Start();
- th.Join(60000);
- th = null;
- private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
- {
- if (!string.IsNullOrEmpty(htmlResult))
- return;
- // DO SOMETHING...
- }
Add Comment
Please, Sign In to add comment