To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > API

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old Aug 28th, 2005, 02:55 AM   #1
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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...
gigemboy is offline   Reply With Quote
Old Aug 28th, 2005, 06:55 AM   #2
penagate
Super Moderator
 
Join Date: Jan 05
Location: Sunny Adelaide
Posts: 12,532
penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)
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)
penagate is offline   Reply With Quote
Old Aug 28th, 2005, 07:00 AM   #3
penagate
Super Moderator
 
Join Date: Jan 05
Location: Sunny Adelaide
Posts: 12,532
penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)
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. lLen = SendMessage(hWndIEServer, WM_GETTEXTLENGTH, 0, ByVal 0&)
  4. SendMessage hWndIEServer, WM_GETTEXT, lLen + 1, sText
penagate is offline   Reply With Quote
Old Aug 28th, 2005, 09:10 AM   #4
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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...
gigemboy is offline   Reply With Quote
Old Aug 28th, 2005, 09:26 AM   #5
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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)
gigemboy is offline   Reply With Quote
Old Aug 28th, 2005, 09:10 PM   #6
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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.
gigemboy is offline   Reply With Quote
Old Aug 29th, 2005, 12:24 AM   #7
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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.     Declare Function RegisterWindowMessage Lib "user32.dll" Alias "RegisterWindowMessageA" ( _
  7.         ByVal lpString As String) As Int32
  8.     Declare Function SendMessageTimeout Lib "user32.dll" Alias "SendMessageTimeoutA" ( _
  9.         ByVal hWnd As Int32, _
  10.         ByVal Msg As Int32, _
  11.         ByVal wParam As Int32, _
  12.         ByVal lParam As Int32, _
  13.         ByVal fuFlags As Int32, _
  14.         ByVal uTimeout As Int32, _
  15.         ByVal lpdwResult As Int32) As Int32
  16.     Public Structure UUID
  17.         Public Data1 As Long
  18.         Public Data2 As Integer
  19.         Public Data3 As Integer
  20.         Public Data4() As Byte
  21.     End Structure
  22.     Public Function WindowDOM(ByVal hWnd As Int32) As IHTMLDocument
  23.         Dim typUUID As UUID, lngRes As Int32, lngMsg As Int32
  24.         lngMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")
  25.         'MsgBox(lngMsg.ToString & " lngmessage")
  26.         If lngMsg <> 0 Then
  27.             Call SendMessageTimeout(hWndIEServer, lngMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, lngRes)
  28.             MsgBox(lngRes.ToString)
  29.             If lngRes <> 0 Then
  30.                 With typUUID
  31.                     .Data1 = &H626FC520
  32.                     .Data2 = &HA41E
  33.                     .Data3 = &H11CF
  34.                     .Data4(0) = &HA7
  35.                     .Data4(1) = &H31
  36.                     .Data4(2) = &H0
  37.                     .Data4(3) = &HA0
  38.                     .Data4(4) = &HC9
  39.                     .Data4(5) = &H8
  40.                     .Data4(6) = &H26
  41.                     .Data4(7) = &H37
  42.                 End With
  43.                 Call ObjectFromLresult(lngRes, typUUID, 0, WindowDOM)
  44.             End If
  45.         End If
  46.     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??
gigemboy is offline   Reply With Quote
Old Sep 21st, 2005, 01:43 PM   #8
WingMan
New Member
 
Join Date: Sep 05
Posts: 1
WingMan is an unknown quantity at this point (<10)
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
WingMan is offline   Reply With Quote
Old Sep 25th, 2005, 04:49 PM   #9
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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??
gigemboy is offline   Reply With Quote
Old Jan 13th, 2006, 12:35 PM   #10
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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
File Type: vb win32.vb (4.8 KB, 908 views)
File Type: vb IEDom.vb (1.3 KB, 983 views)

Last edited by gigemboy; Jan 13th, 2006 at 12:39 PM.
gigemboy is offline   Reply With Quote
Old Jan 13th, 2006, 01:42 PM   #11
iPrank
PoorPoster
 
iPrank's Avatar
 
Join Date: Oct 05
Location: in an island
Posts: 2,654
iPrank is a glorious beacon of light (400+)iPrank is a glorious beacon of light (400+)iPrank is a glorious beacon of light (400+)iPrank is a glorious beacon of light (400+)iPrank is a glorious beacon of light (400+)
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.
iPrank is offline   Reply With Quote
Old Aug 1st, 2006, 02:17 AM   #12
pyzsoft
New Member
 
Join Date: Aug 06
Posts: 2
pyzsoft is an unknown quantity at this point (<10)
Re: Internet Explorer_Server class window

redi can't run success,get nothing,have all code?
pyzsoft is offline   Reply With Quote
Old Aug 1st, 2006, 02:42 AM   #13
pyzsoft
New Member
 
Join Date: Aug 06
Posts: 2
pyzsoft is an unknown quantity at this point (<10)
Re: Internet Explorer_Server class window

i am use vb6,i think that can get vb6's all code?
pyzsoft is offline   Reply With Quote
Old Aug 1st, 2006, 03:08 AM   #14
gigemboy
"The" RedHeadedLefty
 
gigemboy's Avatar
 
Join Date: Aug 05
Location: College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
Posts: 4,461
gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)gigemboy is a glorious beacon of light (400+)
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...
gigemboy is offline   Reply With Quote
Old Aug 9th, 2006, 12:18 AM   #15
bmhung
New Member
 
Join Date: Aug 06
Posts: 1
bmhung is an unknown quantity at this point (<10)
Re: Internet Explorer_Server class window

Can you change that code to C#.Net?
bmhung is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > API


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:49 PM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.