Hack Forums
[.NET] Load web browser while sleep rest of code? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Load web browser while sleep rest of code? (/showthread.php?tid=4627304)



Load web browser while sleep rest of code? - Vezo - Jan 8, 2015

Can someone help me please? I need to load the web page while the rest of the code waits for it to load, i tried so many hours but can't seem to figure it out!

Code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'My.Computer.FileSystem.DeleteFile("C:\Users\Simon\Documents\Visual Studio 2010\Projects\#\#\bin\Release\captcha12.jpg")

        UseProxy(RichTextBox2.Text)
        WebBrowser1.Navigate("http://cc.cc/capt/capt.php?sc=1cve")



        Dim both As Bitmap = New Bitmap(570, 147, Imaging.PixelFormat.Format32bppArgb)
        ' Create a Graphics object that will process the screen shot
        Dim gfx As Graphics = Graphics.FromImage(both)
        ' Copy the screen contents
        gfx.CopyFromScreen(0, 0, -80, -240, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)
        ' Save the resulting graphics

        both.Save("captcha12.jpg", Imaging.ImageFormat.Jpeg)

        PictureBox1.Image = Image.FromFile("C:\Users\Simon\Documents\Visual Studio 2010\Projects\#\#\bin\release\captcha12.jpg")



        Button4.PerformClick()

        'sw.Start()
        'Do
        'Application.DoEvents()
        ' Loop Until sw.ElapsedMilliseconds >= 5000
        'sw.Stop()


        WebBrowser1.Document.GetElementById("adcopy_response").InnerText = RichTextBox3.Text



        'My.Computer.FileSystem.DeleteFile("C:\Users\Simon\Documents\Visual Studio 2010\Projects\#\#\bin\Release\captcha12.jpg")
    End Sub



* - Tedd - Jan 8, 2015

Use your DocumentComplete event to run any code after your page is finished loading..

http://msdn.microsoft.com/en-us/library/aa768329(v=vs.85).aspx


* - Vezo - Jan 8, 2015

(Jan 8, 2015 08:33 PM)Tedd Wrote:  Use your DocumentComplete event to run any code after your page is finished loading..

http://msdn.microsoft.com/en-us/library/aa768329(v=vs.85).aspx
Does not work properly with proxies.