How to Grab all of the text from WebBrowser control.
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 'Internet - How to Grab all of the text from WebBrowser control. Option Explicit Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _ ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Const VK_CONTROL = &H11 Private Const VK_C = &H43 Private Const VK_A = &H41 Private Const KEYEVENTF_KEYUP = &H2 Private Sub Command1_Click() ' Clear the clipboard. Clipboard.Clear ' Set focus to the WebBrowser control. WebBrowser1.SetFocus ' Control-A. ' Press Control. keybd_event VK_CONTROL, 0, 0, 0 DoEvents ' Press A. keybd_event VK_A, 1, 0, 0 DoEvents ' Control-C. ' Press Control. keybd_event VK_CONTROL, 0, 0, 0 DoEvents ' Press C. keybd_event VK_C, 1, 0, 0 DoEvents ' Release Control. keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0 DoEvents ' Get the text from the clipboard. Text1.Text = Clipboard.GetText End Sub Private Sub Form_Load() WebBrowser1.Navigate "http://www.codeitbetter.co.nr" End Sub |