m12321 Posted May 26, 2007 Share Posted May 26, 2007 (edited) Hey I have a answer machineBut when it ran,someting wrong happened.Does anyone help me fix it.I'm using VB6.This is my wrong place.And my code just like under.expandcollapse popupOption Explicit 'CODED BY JOHN CASEY; SPIYRE@MSN.COM 'DONT FORGET REFERENCE TO "MICROSOFT HTML OBJECT LIBRARY" Public Declare Function ObjectFromLresult Lib "oleacc" (ByVal lResult As Long, riid As UUID, ByVal wParam As Long, ppvObject As Any) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Public 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 Public Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long Type UUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As Byte End Type Public Const SMTO_ABORTIFHUNG = &H2 Function getietext(ByVal hWnd As Long) As String On Error Resume Next Dim doc As IHTMLDocument2 If hWnd <> 0 Then Set doc = IEDOMFromhWnd(hWnd) Else getietext = "-[TEXT CANNOT BE FOUND]-" Exit Function End If '---CHECKS-FOR-HWND------ If doc.body.innerText = vbNullString Then getietext = "ERROR! [WINDOW DOESN'T CONTAIN HTML]" Exit Function End If '---CHECKS-FOR-HTML-EMBEDDED getietext = doc.body.innerText End Function Function IEDOMFromhWnd(ByVal hWnd As Long) As IHTMLDocument Dim IID_IHTMLDocument As UUID Dim doc As IHTMLDocument2 Dim lRes As Long 'if = 0 isn't inet window. Dim lMsg As Long Dim hr As Long '---END-DECLARES--------- ' Register the message lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT") ' Get the object Call SendMessageTimeout(hWnd, lMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes) '---CHECKS-FOR-WINDOW---- hr = ObjectFromLresult(lRes, IID_IHTMLDocument, 0, IEDOMFromhWnd) End FunctionIs the " lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT") ' Get the object Call SendMessageTimeout(hWnd, lMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes)" place wrong?Because the "Function getietext(ByVal hWnd As Long) As StringOn Error Resume NextDim doc As IHTMLDocument2If hWnd <> 0 ThenSet doc = IEDOMFromhWnd(hWnd)Elsegetietext = "-[TEXT CANNOT BE FOUND]-"Exit FunctionEnd If" place is my wrong.So...please help me And this is one aonther code.Or is the" List1.AddItem " " & getietext(window(3)) & " @ " & Now" place wrong?I really don't know how to do,please help me to fix it. Private Sub Timer1_Timer() Dim imclass As Long imclass = FindWindow("ysearchmenuwndclass", vbNullString) If imclass >= 1 Then Pause (0.4) Dim window(1 To 3) As Long window(1) = FindWindow("ysearchmenuwndclass", vbNullString) window(2) = FindWindowEx(window(1), 0, "ATL:0054E0E0", vbNullString) window(3) = FindWindowEx(window(2), 0, "Internet Explorer_Server", vbNullString) List1.AddItem " " & getietext(window(3)) & " @ " & Now Pause (0.2) YIM8ChatSend "answer: " & Text1.Text & " " Label1.Caption = Label1.Caption + 1 ClosePm End If End Sub Edited May 26, 2007 by m12321 Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 26, 2007 Moderators Share Posted May 26, 2007 You seem to have gotten a little lost. This Forum is for AutoIt related question, not VB. Link to comment Share on other sites More sharing options...
m12321 Posted May 26, 2007 Author Share Posted May 26, 2007 You seem to have gotten a little lost. This Forum is for AutoIt related question, not VB.Ooops,then where should I ask? Link to comment Share on other sites More sharing options...
Generator Posted May 26, 2007 Share Posted May 26, 2007 Ooops,then where should I ask?Some VB forum -___- Link to comment Share on other sites More sharing options...
m12321 Posted May 26, 2007 Author Share Posted May 26, 2007 hm... Then,the web site have no VB forum - -? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 27, 2007 Share Posted May 27, 2007 (edited) hm...Then,the web site have no VB forum - -?You really are lost. This site and forum are only for AutoIt.You can try: VisualBasicScript.comBut when you get sick and tired of VBS, we'll see you back here!Cheers! P.S. Here's 2,460,000 more sites for you. Edited May 27, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
m12321 Posted May 27, 2007 Author Share Posted May 27, 2007 Yes,I really lost Thanks everyone's help. I'll find another place to solve my question Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now