VB.NET GET TEXT FROM Internet Explorer_Server

  • Thread starter Thread starter Yousef F
  • Start date Start date
Y

Yousef F

Guest
PLEASE HELP ME ,, I TRY GET TEXT FROM CHAT

Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Runtime.InteropServices

Public Class Form1

Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Public Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Int32) As Int32
Public Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As String) As Int32
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As System.Text.StringBuilder) As Int32



Public Const WM_SETTEXT As Int32 = &HC
Public Const WM_GETTEXT As Int32 = &HD
Public Const WM_GETTEXTLENGTH As Int32 = &HE

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Hwmd As Integer = FindWindow(TextBox1.Text, TextBox2.Text)
Dim Hwmd2 As Integer = FindWindowEx(Hwmd, Nothing, "TPanel", Nothing)
Dim Hwmd3 As Integer = FindWindowEx(Hwmd, Hwmd2, "TPanel", Nothing)
Dim Hwmd4 As Integer = FindWindowEx(Hwmd, Hwmd3, "TPanel", Nothing)
Dim Hwmd5 As Integer = FindWindowEx(Hwmd, Hwmd4, "TPanel", Nothing)
Dim Hwmd6 As Integer = FindWindowEx(Hwmd, Hwmd5, "TPanel", Nothing)
Dim Hwmd7 As Integer = FindWindowEx(Hwmd6, Nothing, "TPanel", Nothing)
Dim Hwmd8 As Integer = FindWindowEx(Hwmd6, Hwmd7, "TPanel", Nothing)
Dim Hwmd9 As Integer = FindWindowEx(Hwmd8, Nothing, "Shell Embedding", Nothing)
Dim Hwmd10 As Integer = FindWindowEx(Hwmd9, Nothing, "Shell DocObject View", Nothing)
Dim Hwmd11 As Integer = FindWindowEx(Hwmd10, Nothing, "Internet Explorer_Server", Nothing)

Dim COUNT As Integer
Dim SB As System.Text.StringBuilder

If (Not Hwmd11 = 0) Then
MsgBox(Hwmd11.ToString)
COUNT = SendMessage(Hwmd11, WM_GETTEXTLENGTH, 0, 0)
SB = New System.Text.StringBuilder(COUNT)
SendMessage(Hwmd11, WM_GETTEXTLENGTH, SB.Capacity, SB)
MsgBox(SB.ToString)
RichTextBox1.Text = SB.ToString
End If
End Sub
End Class

Continue reading...
 
Back
Top