Results 1 to 15 of 15

Thread: Internet Explorer_Server class window

  1. #1

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Internet Explorer_Server class window

    Anyone know how to pull text out of this kind of control? It is an Internet Explorer_Server class control inside of a messenger window, namely Yahoo. The chat room text. I want to pull this data out and analyze it. I cant seem to even pull the handle out through code (but i can see it through Spy++). The parent is YHTMLContainer class, and the YHTMLContainer is the child to the IMClass class.

    The following code executes correctly:
    VB Code:
    1. hWndTmp = FindWindow("IMClass", "*Replaced with WindowTitle*")
    2. hWndChild = FindWindowEx(hWndTmp, 0, "YHTMLContainer", vbNullString)

    Kinda confused next.. The Internet Explorer_Server is the child of a child, per se.. the child of YHTMLContainer.... how would I get the handle.. i tried doing a FindWindow on just the class Internet Explorer_Server but kept returning nothing. Also, doing a FindWindowEx on Internet Explorer_Server also returned nothing.

    All this and I still have to figure out how to get the text in the control to my application...

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Internet Explorer_Server class window

    Do FindWindowEx() on hWndChild. Also, you can just pass vbNullString instead of the window title, unless you specifically need to find that window.

    so

    VB Code:
    1. hWndTmp = FindWindow("IMClass", "*Replaced with WindowTitle*")
    2. hWndChild = FindWindowEx(hWndTmp, 0, "YHTMLContainer", vbNullString)
    3. hWndIEServer = FindWindowEx(hWndChild, 0&, "Class name of IE server", vbNullString)

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Internet Explorer_Server class window

    Oh and, to get the text, try

    VB Code:
    1. Const WM_GETTEXT = &HD
    2. Const WM_GETTEXTLENGTH = &HE
    3.  
    4. lLen = SendMessage(hWndIEServer, WM_GETTEXTLENGTH, 0, ByVal 0&)
    5. SendMessage hWndIEServer, WM_GETTEXT, lLen + 1, sText

  4. #4

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: Internet Explorer_Server class window

    Hmmm.. couldve sworn I tried that 10 times already, but copied your third line into mine for the hwndIEServer and it worked lol ... thx gonna work on the text part now...

  5. #5

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    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:
    1. hWndTmp = FindWindow("IMClass", "SymbolType")
    2.         hWndChild = FindWindowEx(hWndTmp, 0, "YHTMLContainer", vbNullString)
    3.         hWndIEServer = FindWindowEx(hWndChild, 0, "Internet Explorer_Server", vbNullString)
    4.         Dim lLen As Long
    5.         Dim IElen As Long
    6.         Dim sText As String
    7.         lLen = SendMessage(hWndIEServer, WM_GETTEXTLENGTH, 0, IElen)
    8.         SendMessage(hWndIEServer, WM_GETTEXT, lLen + 1, sText)

  6. #6

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    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.

  7. #7

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    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:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim objDoc As IHTMLDocument
    3.         hWndTmp = FindWindow("IMClass", "*window title*")
    4.         hWndChild = FindWindowEx(hWndTmp, 0, "YHTMLContainer", vbNullString)
    5.         hWndIEServer = FindWindowEx(hWndChild, 0, "Internet Explorer_Server", vbNullString)
    6.         MsgBox(hWndIEServer)
    7.         If hWndIEServer > 0 Then
    8.             objDoc = WindowDOM(hWndIEServer)
    9.             If Not (objDoc Is Nothing) Then
    10.                 MsgBox(objDoc.body.innerText)
    11.             End If
    12.         End If
    13.     End Sub
    The Associated Functions and structures are below :
    VB Code:
    1. Declare Function ObjectFromLresult Lib "oleacc.dll" ( _
    2.         ByVal lResult As Int32, _
    3.         ByVal riid As UUID, _
    4.         ByVal wParam As Int32, _
    5.         ByVal ppvObject As Object) As Int32
    6.  
    7.     Declare Function RegisterWindowMessage Lib "user32.dll" Alias "RegisterWindowMessageA" ( _
    8.         ByVal lpString As String) As Int32
    9.  
    10.     Declare Function SendMessageTimeout Lib "user32.dll" Alias "SendMessageTimeoutA" ( _
    11.         ByVal hWnd As Int32, _
    12.         ByVal Msg As Int32, _
    13.         ByVal wParam As Int32, _
    14.         ByVal lParam As Int32, _
    15.         ByVal fuFlags As Int32, _
    16.         ByVal uTimeout As Int32, _
    17.         ByVal lpdwResult As Int32) As Int32
    18.  
    19.     Public Structure UUID
    20.         Public Data1 As Long
    21.         Public Data2 As Integer
    22.         Public Data3 As Integer
    23.         Public Data4() As Byte
    24.     End Structure
    25.     Public Function WindowDOM(ByVal hWnd As Int32) As IHTMLDocument
    26.         Dim typUUID As UUID, lngRes As Int32, lngMsg As Int32
    27.         lngMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")
    28.         'MsgBox(lngMsg.ToString & " lngmessage")
    29.         If lngMsg <> 0 Then
    30.             Call SendMessageTimeout(hWndIEServer, lngMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, lngRes)
    31.             MsgBox(lngRes.ToString)
    32.             If lngRes <> 0 Then
    33.                 With typUUID
    34.                     .Data1 = &H626FC520
    35.                     .Data2 = &HA41E
    36.                     .Data3 = &H11CF
    37.                     .Data4(0) = &HA7
    38.                     .Data4(1) = &H31
    39.                     .Data4(2) = &H0
    40.                     .Data4(3) = &HA0
    41.                     .Data4(4) = &HC9
    42.                     .Data4(5) = &H8
    43.                     .Data4(6) = &H26
    44.                     .Data4(7) = &H37
    45.                 End With
    46.                 Call ObjectFromLresult(lngRes, typUUID, 0, WindowDOM)
    47.             End If
    48.         End If
    49.     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??

  8. #8
    New Member
    Join Date
    Sep 2005
    Posts
    1

    Re: Internet Explorer_Server class window

    Hey,

    Did you ever get this going? I'm currently working on the same issue. Let me know if you found the solution. - Thanks Dennis

  9. #9

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: Internet Explorer_Server class window

    I sure did WingMan... my code was a little messy, but I did find some code on the net that utilizes an IEDom class, to get the http object. Have it in a project that returns the innertext of the document that is currently inside the Internet Explorer window.... gimme a few minutes and I'll post the code....

    Rather... do you want the code to get the text out of Internet Explorer?? or in regards to Yahoo Instant Messenger, which also uses the Internet Explorer_Class window??

  10. #10

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: Internet Explorer_Server class window

    Here's the code where you can get the information into a string from the class window hwnd.. its in an IEdom class and in a win32 functions class... to get the html into a string, you just call the following:
    VB Code:
    1. 'hwndTmpGetIE is the handle to the Internet Explorer_Class window....
    2. Dim i As IHTMLDocument = ieDom.IEDOMFromhWnd(hwndTmpGetIE)
    3. strHTML = Strings.LCase(i.documentElement.innertext.ToString)
    And the two classes are attached below (the win32 functions class has more declarations that is actually used, its just a common class I use that I put my API functions in..)

    **Note been a while since I used this code, and it might be a little messy because I was just first beginning when I wrote it...
    Attached Files Attached Files
    Last edited by gigemboy; Jan 13th, 2006 at 12:39 PM.

  11. #11
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,728

    Re: Internet Explorer_Server class window

    check if this page helps you.

    Edit: Great ! You have solved it.
    Last edited by iPrank; Jan 13th, 2006 at 01:47 PM.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  12. #12
    New Member
    Join Date
    Aug 2006
    Posts
    2

    Re: Internet Explorer_Server class window

    redi can't run success,get nothing,have all code?

  13. #13
    New Member
    Join Date
    Aug 2006
    Posts
    2

    Re: Internet Explorer_Server class window

    i am use vb6,i think that can get vb6's all code?

  14. #14

    Thread Starter
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: Internet Explorer_Server class window

    The code posted was .NET code, if that helps explain a little as to why it won't work in VB6... you would have to use the VB6 declarations...

  15. #15
    New Member
    Join Date
    Aug 2006
    Posts
    1

    Re: Internet Explorer_Server class window

    Can you change that code to C#.Net?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width