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 :
The Associated Functions and structures are below :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 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.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 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??




Reply With Quote