Results 1 to 5 of 5

Thread: Inet control refreshing problem !?!?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    282

    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:
    1. lStart = 1
    2.   lEnd = 1
    3.   sFindStart = "news this hour:"
    4.   sFindEnd = vbNewLine
    5.   sSource = ""
    6.   sSource = Inet1.OpenURL(GetSetting(App.EXEName, "Settings", "text1", ""))
    7.  
    8.   Do While Inet1.StillExecuting
    9.    DoEvents
    10.     Loop
    11.  
    12. Inet1.Execute , "CLOSE"
    13.  
    14.   lStart = InStr(lStart, sSource, sFindStart, vbTextCompare)
    15.        If lStart Then
    16.               lStart = lStart + Len(sFindStart)
    17.                     lEnd = InStr(lStart, sSource, sFindEnd, vbTextCompare)
    18.        If lEnd > lStart Then
    19.           Text1.Text = Mid$(sSource, lStart, lEnd - lStart)
    20.           Else
    21.               Debug.Print "Cant find text."
    22.           End If
    23.           Else
    24.               Debug.Print "Cant find text."
    25.          
    26.       End If
    27.    End If


    So Text1.Text remains same when using loop mode, WHY
    And web site info changes

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    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?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    282

    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 )!

  4. #4
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Inet control refreshing problem !?!?

    Quote 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.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    282

    Re: Inet control refreshing problem !?!?

    VB Code:
    1. Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    2. Public Sub Pause(Milliseconds As Single)
    3.     Dim sngEnding As Single
    4.     sngEnding = Timer + (Milliseconds / 1000)
    5.     Do Until Timer >= sngEnding
    6.         Sleep 1
    7.         DoEvents
    8.     Loop
    9. End Sub

    here is problem....
    VB Code:
    1. Private Sub Timer1_Timer()
    2. On Error Resume Next
    3.  
    4. Do
    5. If Option1.Value = True Then
    6. lStart = 1
    7.   lEnd = 1
    8.   sFindStart = "news this hour:"
    9.   sFindEnd = vbNewLine
    10.   sSource = ""
    11.   sSource = Inet1.OpenURL(GetSetting(App.EXEName, "Settings", "text1", ""))
    12.  
    13.   Do While Inet1.StillExecuting
    14.    DoEvents
    15.     Loop
    16.  
    17. Inet1.Execute , "CLOSE"
    18.  
    19.   lStart = InStr(lStart, sSource, sFindStart, vbTextCompare)
    20.        If lStart Then
    21.               lStart = lStart + Len(sFindStart)
    22.                     lEnd = InStr(lStart, sSource, sFindEnd, vbTextCompare)
    23.        If lEnd > lStart Then
    24.           Text1.Text = Mid$(sSource, lStart, lEnd - lStart)
    25.           Else
    26.               Debug.Print "Cant find text."
    27.           End If
    28.           Else
    29.               Debug.Print "Cant find text."
    30.          
    31.       End If
    32.    End If
    33.  
    34. pause 2000
    35.  
    36. If Option2.Value = True Then
    37. another code...
    38.  
    39.  
    40.  
    41.  
    42. ...
    43.  
    44. 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
  •  



Click Here to Expand Forum to Full Width