Internet Explorer_Server Class

So this is a code that I’ve found while browsing google on how to get text from “Internet Explorer_Server”.

I thought it’s the same in the Paltalk as you can simply get the text with it’s class “RichEdit20W”. But its totally different. It’s like dealing with a chat text in EI Browser.

This code is used to connect in Camfrog, AIM, Yahoo Messenger ect…

PS: I have no skills or idea on how to write a code. But I do understand it a little. And in the case of CAMFROG build nowadays, it works. Cause someone has a Music Trivia Bot/Trivia Bot in Camfrog which is built in VB6. But He don’t want to upload it. (DUNNO WHY) so Im sharing this code for the developers who are messing with IE Server’s Text.

Here’s the code:

VB6 Version:
“Requires: reference to “Microsoft HTML Object Library”

Private Type UUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type

Private Declare Function GetClassName Lib "user32" _
Alias "GetClassNameA" ( _
ByVal hWnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) As Long

Private Declare Function EnumChildWindows Lib "user32" ( _
ByVal hWndParent As Long, _
ByVal lpEnumFunc As Long, _
lParam As Long) As Long

Private Declare Function RegisterWindowMessage Lib "user32" _
Alias "RegisterWindowMessageA" ( _
ByVal lpString As String) As Long

Private Declare Function SendMessageTimeout Lib "user32" _
Alias "SendMessageTimeoutA" ( _
ByVal hWnd As Long, _
ByVal msg As Long, _
ByVal wParam As Long, _
lParam As Any, _
ByVal fuFlags As Long, _
ByVal uTimeout As Long, _
lpdwResult As Long) As Long

Private Const SMTO_ABORTIFHUNG = &H2

Private Declare Function ObjectFromLresult Lib "oleacc" ( _
ByVal lResult As Long, _
riid As UUID, _
ByVal wParam As Long, _
ppvObject As Any) As Long

Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

'
' IEDOMFromhWnd
'
' Returns the IHTMLDocument interface from a WebBrowser window
'
' hWnd - Window handle of the control
'
Function IEDOMFromhWnd(ByVal hWnd As Long) As IHTMLDocument
Dim IID_IHTMLDocument As UUID
Dim hWndChild As Long
Dim lRes As Long
Dim lMsg As Long
Dim hr As Long

If hWnd <> 0 Then

If Not IsIEServerWindow(hWnd) Then

' Find a child IE server window
EnumChildWindows hWnd, AddressOf EnumChildProc, hWnd

End If

If hWnd <> 0 Then

' Register the message
lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")

' Get the object pointer
Call SendMessageTimeout(hWnd, lMsg, 0, 0, _
SMTO_ABORTIFHUNG, 1000, lRes)

If lRes Then

' Initialize the interface ID
With IID_IHTMLDocument
.Data1 = &H626FC520
.Data2 = &HA41E
.Data3 = &H11CF
.Data4(0) = &HA7
.Data4(1) = &H31
.Data4(2) = &H0
.Data4(3) = &HA0
.Data4(4) = &HC9
.Data4(5) = &H8
.Data4(6) = &H26
.Data4(7) = &H37
End With

' Get the object from lRes
hr = ObjectFromLresult(lRes, IID_IHTMLDocument,_
0, IEDOMFromhWnd)

End If

End If

End If

End Function

Private Function IsIEServerWindow(ByVal hWnd As Long) As Boolean
Dim lRes As Long
Dim sClassName As String

' Initialize the buffer
sClassName = String$(100, 0)

' Get the window class name
lRes = GetClassName(hWnd, sClassName, Len(sClassName))
sClassName = Left$(sClassName, lRes)

IsIEServerWindow = StrComp(sClassName, _
"Internet Explorer_Server", _
vbTextCompare) = 0

End Function

'
' Copy this function to a .bas module
'
Function EnumChildProc(ByVal hWnd As Long, lParam As Long) As Long

If IsIEServerWindow(hWnd) Then
lParam = hWnd
Else
EnumChildProc = 1
End If

End Function

===============================================================================

VB.NET Version:

Imports mshtml
Imports System.Text
Imports System.Runtime.InteropServices

Namespace Edanmo

Public Module IEDom

Declare Ansi Function GetClassName Lib "user32" _
Alias "GetClassNameA" ( _
ByVal hWnd As IntPtr, _
ByVal lpClassName As StringBuilder, _
ByVal nMaxCount As Int32) As Int32

Delegate Function EnumChildProc( _
ByVal hWnd As IntPtr, _
ByRef lParam As IntPtr) As Int32

Declare Function EnumChildWindows Lib "user32" ( _
ByVal hWndParent As IntPtr, _
ByVal lpEnumFunc As EnumChildProc, _
ByRef lParam As IntPtr) As Int32

Declare Ansi Function RegisterWindowMessage Lib "user32" _
Alias "RegisterWindowMessageA" ( _
ByVal lpString As String) As Int32

Declare Ansi Function SendMessageTimeout Lib "user32" _
Alias "SendMessageTimeoutA" ( _
ByVal hWnd As IntPtr, _
ByVal msg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32, _
ByVal fuFlags As Int32, _
ByVal uTimeout As Int32, _
ByRef lpdwResult As Int32) As Int32

Const SMTO_ABORTIFHUNG As Int32 = &H2

Declare Function ObjectFromLresult Lib "oleacc" ( _
ByVal lResult As Int32, _
ByRef riid As System.Guid, _
ByVal wParam As Int32, _
ByRef ppvObject As IHTMLDocument) As Int32

Public Function IEDOMFromhWnd(ByVal hWnd As IntPtr) As IHTMLDocument

Dim IID_IHTMLDocument As System.Guid = New System.Guid("626FC520-A41E-11CF-A731-00A0C9082637")
Dim hWndChild As Int32
Dim lRes As Int32
Dim lMsg As Int32
Dim hr As Int32

If Not hWnd.Equals(0) Then

If Not IsIEServerWindow(hWnd) Then

' Get 1st child IE server window
EnumChildWindows(hWnd, AddressOf EnumChild, hWnd)

End If

If Not hWnd.Equals(0) Then

' Register the message
lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")

' Get the object
Call SendMessageTimeout(hWnd, lMsg, 0, 0, _
SMTO_ABORTIFHUNG, 1000, lRes)

If lRes Then

' Get the object from lRes
hr = ObjectFromLresult(lRes, IID_IHTMLDocument, 0, IEDOMFromhWnd)

If hr Then Throw New comexception(hr)

End If

End If

End If

End Function

Private Function EnumChild(ByVal hWnd As IntPtr, ByRef lParam As IntPtr) As Int32

If IsIEServerWindow(hWnd) Then
lParam = hWnd
Else
EnumChild = 1
End If

End Function

Private Function IsIEServerWindow(ByVal hWnd As IntPtr) As Boolean

Dim Res As Int32
Dim ClassName As StringBuilder = New StringBuilder(100)

' Get the window class name
Res = GetClassName(hWnd, ClassName, ClassName.MaxCapacity)
IsIEServerWindow = StrComp( _
ClassName.ToString(), _
"Internet Explorer_Server", _
CompareMethod.Text) = 0

End Function

End Module

End Namespace

6 thoughts on “Internet Explorer_Server Class

  1. In Camfrog, you must turn on or checked the Join and Quit option under Settings>IM Tab. Haven’t been online since last October in Camfrog. Can you create a Music Trivia Bot Brad?

  2. This is fantastic. I’ve been trying to figure this out for weeks, and you found both the .NET and VB6 code. amazing.

    All that you need to get this code going is this:

    Dim html As HTMLDocument
    html = IEDOMFromhWnd(hwnd)
    MsgBox(html.body.innerText)

    OKAY, so… any idea how to get the list of chatroom members? I started a new thread

  3. This is fantastic. I’ve been trying to figure this out for weeks, and you found both the .NET and VB6 code. amazing.

    All that you need to get this code going is this:

    Dim html As HTMLDocument
    html = IEDOMFromhWnd(hwnd)
    MsgBox(html.body.innerText)

    OKAY, so… any idea how to get the list of chatroom members? I started a new thread

    Oh you make it sound so easy.

Leave a Reply

You must Register or Login to comment on Internet Explorer_Server Class