Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. WebBrowser1.Navigate("URL", "", paramInByte, "Content-Type:application/x-www-form-urlencoded")
  2.  
  3. 'scroll to the picture, so we have a WebBrowser object just like a picture box
  4. For Each i As HtmlElement In w.Document.GetElementsByTagName("img")
  5. If i.GetAttribute("src").Contains("here string to identify captcha image") Then
  6. i.ScrollIntoView(True)
  7. End If
  8. Next
  9.  
  10. 'Create bitmap
  11. Dim bmp As New Bitmap(w.Width, w.Height, Imaging.PixelFormat.Format32bppArgb)
  12. Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bmp)
  13. Dim hdc As IntPtr = g.GetHdc
  14.  
  15. 'Do the Drawing
  16. Dim pUnk As IntPtr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(w.ActiveXInstance)
  17. OLE32.OleDraw(pUnk, 1, hdc, New Rectangle(0, 0, w.Width, w.Height))
  18. System.Runtime.InteropServices.Marshal.Release(pUnk)
  19.  
  20. 'Release DC and dispose
  21. g.ReleaseHdc(hdc)
  22. g.Dispose()
  23.  
  24. Public Class OLE32
  25. Public Declare Function OleDraw Lib "ole32.dll" (ByVal pUnk As IntPtr, ByVal dwAspect As Integer, ByVal hdcDraw As IntPtr, ByRef lprcBounds As Rectangle) As Integer
  26. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement