|
-
Aug 28th, 2005, 08:26 AM
#1
Re: Internet Explorer_Server class window
The code to get the text doesnt work.. i returns a zero value. The code I have so far is below, all the handles pull nonzerovalues. The SendMessage statements return 0.
VB Code:
hWndTmp = FindWindow("IMClass", "SymbolType")
hWndChild = FindWindowEx(hWndTmp, 0, "YHTMLContainer", vbNullString)
hWndIEServer = FindWindowEx(hWndChild, 0, "Internet Explorer_Server", vbNullString)
Dim lLen As Long
Dim IElen As Long
Dim sText As String
lLen = SendMessage(hWndIEServer, WM_GETTEXTLENGTH, 0, IElen)
SendMessage(hWndIEServer, WM_GETTEXT, lLen + 1, sText)
-
Aug 28th, 2005, 08:10 PM
#2
Re: Internet Explorer_Server class window
Im guessing the code won't work because it is some sort of HTML object. Anyone know how to pull text from the Internet Explorer_Server class window? The same class is used as the main window in Internet Explorer, so surely someone out there has done it.
-
Aug 28th, 2005, 11:24 PM
#3
Re: Internet Explorer_Server class window
I now am pulling the HTML Object out of the window, but I am still getting a blank document. Here is some of the code :
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objDoc As IHTMLDocument
hWndTmp = FindWindow("IMClass", "*window title*")
hWndChild = FindWindowEx(hWndTmp, 0, "YHTMLContainer", vbNullString)
hWndIEServer = FindWindowEx(hWndChild, 0, "Internet Explorer_Server", vbNullString)
MsgBox(hWndIEServer)
If hWndIEServer > 0 Then
objDoc = WindowDOM(hWndIEServer)
If Not (objDoc Is Nothing) Then
MsgBox(objDoc.body.innerText)
End If
End If
End Sub
The Associated Functions and structures are below :
VB Code:
Declare Function ObjectFromLresult Lib "oleacc.dll" ( _
ByVal lResult As Int32, _
ByVal riid As UUID, _
ByVal wParam As Int32, _
ByVal ppvObject As Object) As Int32
Declare Function RegisterWindowMessage Lib "user32.dll" Alias "RegisterWindowMessageA" ( _
ByVal lpString As String) As Int32
Declare Function SendMessageTimeout Lib "user32.dll" Alias "SendMessageTimeoutA" ( _
ByVal hWnd As Int32, _
ByVal Msg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32, _
ByVal fuFlags As Int32, _
ByVal uTimeout As Int32, _
ByVal lpdwResult As Int32) As Int32
Public Structure UUID
Public Data1 As Long
Public Data2 As Integer
Public Data3 As Integer
Public Data4() As Byte
End Structure
Public Function WindowDOM(ByVal hWnd As Int32) As IHTMLDocument
Dim typUUID As UUID, lngRes As Int32, lngMsg As Int32
lngMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")
'MsgBox(lngMsg.ToString & " lngmessage")
If lngMsg <> 0 Then
Call SendMessageTimeout(hWndIEServer, lngMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, lngRes)
MsgBox(lngRes.ToString)
If lngRes <> 0 Then
With typUUID
.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
Call ObjectFromLresult(lngRes, typUUID, 0, WindowDOM)
End If
End If
End Function
The code all runs without errors, however the "objDoc = WindowDOM(hWndIEServer)" posted on the button click is a blank document, because the If statement isnt ran.
The SendMessageTimeout function call in the WindowDom function brings back a message of 0, which is where i think the holdup is. I can feel im getting real close... anyone know of something i can try??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|