Sign in to follow this  
Followers 0
m12321

Anyone help me to fix the auto machine

7 posts in this topic

#1 ·  Posted (edited)

Hey I have a answer machine

But when it ran,someting wrong happened.

Does anyone help me fix it.

I'm using VB6.

Posted Image

This is my wrong place.

And my code just like under.

Option 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 Function

Is 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 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

" 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 by m12321

Share this post


Link to post
Share on other sites



You seem to have gotten a little lost. This Forum is for AutoIt related question, not VB.

Share this post


Link to post
Share on other sites

You seem to have gotten a little lost. This Forum is for AutoIt related question, not VB.

Ooops,then where should I ask?

Share this post


Link to post
Share on other sites

Ooops,then where should I ask?

Some VB forum -___-

Share this post


Link to post
Share on other sites

hm...

Then,the web site have no VB forum - -?

Share this post


Link to post
Share on other sites

#6 ·  Posted (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.com

But 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 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

Share this post


Link to post
Share on other sites

Yes,I really lost :)

Thanks everyone's help.

I'll find another place to solve my question :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0