Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inet1.OpenURL response problem
Message
General information
Forum:
Visual Basic
Category:
Internet applications
Miscellaneous
Thread ID:
00340944
Message ID:
00341198
Views:
21
Robert,

I just finished a big project using this control. Are you using it to get an HTML file, or download a file
to disk? There are 2 ways to do it, one if you want to display status messages as it is downloading, and
the other if you just want your program to freeze until the entire download is complete (say for small files)



>Using Visual Studio 6.0, SP3 applied, VB6 controls, I have a problem running the following subroutine:
>
>Private Sub PHttp_SavePGS(Pathname As String, SrceName As String)
>    Dim FuncNm As String
>    Dim strData As String
>    Dim URLAddr As String
>    FuncNm = "PHttp_SavePGS"
>    URLAddr = SrceName
>    If Left(URLAddr, 4) <> "http" Then
>      MsgBox ("Can only access http locations")
>      Exit Sub
>    End If
>
>    strData = Inet1.OpenURL(URLAddr, icString)
>    If Len(strData) = 0 Then
>      MsgBox (FuncNm & ": Err retrieving" _
>        & Chr(13) & Chr(10) _
>        & URLAddr & Chr(13) & Chr(10) _
>        & "maybe" & Chr(13) & Chr(10) _
>        & Inet1.ResponseInfo)
>      Exit Sub
>    End If
>
>When there is no connection to the internet service provider, the operation fails with "unable to resolve address" and returns a null string, just as it should; however, within the testing IF statement the ResponseCode and ResponseInfo have not yet been set at the time this test is being executed. Supposedly OpenURL will not return until it has a complete response. If I run this, no reason appears in the msgbox unless I set a breakpoint with the debugger onto the IF statement. At the breakpoint, the local watch window shows responsecode of zero and empty responseinfo. When I continue from there, the correct responseinfo appears in the msgbog.
>Is there a reliable way of suspending my thread execution for a few milliseconds (without doing something like opening a file) so as to allow the control to catch up with its housekeeping?
>Or did I really miss something about how OpenURL should be handled?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform