|
-
Sep 2nd, 2006, 10:55 AM
#1
Thread Starter
Hyperactive Member
Inet control refreshing problem !?!?
Hello, I use this code to monitor some changes on site index,
evrything works OK when first time getting data, and when I
use it in loop mode, all info remains same but it chages on site!
What is wrong with this code, why he dont read site info in loop mode?
VB Code:
lStart = 1
lEnd = 1
sFindStart = "news this hour:"
sFindEnd = vbNewLine
sSource = ""
sSource = Inet1.OpenURL(GetSetting(App.EXEName, "Settings", "text1", ""))
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Execute , "CLOSE"
lStart = InStr(lStart, sSource, sFindStart, vbTextCompare)
If lStart Then
lStart = lStart + Len(sFindStart)
lEnd = InStr(lStart, sSource, sFindEnd, vbTextCompare)
If lEnd > lStart Then
Text1.Text = Mid$(sSource, lStart, lEnd - lStart)
Else
Debug.Print "Cant find text."
End If
Else
Debug.Print "Cant find text."
End If
End If
So Text1.Text remains same when using loop mode, WHY 
And web site info changes
-
Sep 2nd, 2006, 11:06 AM
#2
Re: Inet control refreshing problem !?!?
That Do loop doesn't help you much - when Inet is done, it stops "looping". Do you have this in a timer or some other sub?
-
Sep 2nd, 2006, 11:09 AM
#3
Thread Starter
Hyperactive Member
Re: Inet control refreshing problem !?!?
I have Timer, and all posted above code is in main do loop, there are
different option's and only this one not working correctly ( stuck on old info )!
-
Sep 2nd, 2006, 11:10 AM
#4
PowerPoster
Re: Inet control refreshing problem !?!?
 Originally Posted by gavio
That Do loop doesn't help you much - when Inet is done, it stops "looping".
I think you'll find that's the *point* of the do loop...without it, it'd try to read partial source...that's there to wait until inet's finished then do stuff with the HTML source downloaded...a trick I use often
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Sep 2nd, 2006, 11:16 AM
#5
Thread Starter
Hyperactive Member
Re: Inet control refreshing problem !?!?
VB Code:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub Pause(Milliseconds As Single)
Dim sngEnding As Single
sngEnding = Timer + (Milliseconds / 1000)
Do Until Timer >= sngEnding
Sleep 1
DoEvents
Loop
End Sub
here is problem....
VB Code:
Private Sub Timer1_Timer()
On Error Resume Next
Do
If Option1.Value = True Then
lStart = 1
lEnd = 1
sFindStart = "news this hour:"
sFindEnd = vbNewLine
sSource = ""
sSource = Inet1.OpenURL(GetSetting(App.EXEName, "Settings", "text1", ""))
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Execute , "CLOSE"
lStart = InStr(lStart, sSource, sFindStart, vbTextCompare)
If lStart Then
lStart = lStart + Len(sFindStart)
lEnd = InStr(lStart, sSource, sFindEnd, vbTextCompare)
If lEnd > lStart Then
Text1.Text = Mid$(sSource, lStart, lEnd - lStart)
Else
Debug.Print "Cant find text."
End If
Else
Debug.Print "Cant find text."
End If
End If
pause 2000
If Option2.Value = True Then
another code...
...
Loop Until Text2.Text <> Text1.Text
Last edited by VB Client/Server; Sep 2nd, 2006 at 11:44 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|