Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > How to refresh a web page and auto acknowldge the retry message?


Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-2005, 01:39 PM
Mabsey Mabsey is offline
Regular
 
Join Date: Feb 2005
Posts: 66
Default How to refresh a web page and auto acknowldge the retry message?


I have launched a shell'd IE window and occasionally it gets stuck with a page cannot be displayed messaged. Well in my timer I am scanning for IE windows and when it finds a windows with such a message, I issue a IE.REFRESH command. The trouble is that the windows are submitting information, so the window just sits there waiting for the user to hit the retry button. Is there anyway to refresh the IE Page and not have the retry message come up, so it's transparent to the user?

Thanks for looking

Masbey
Reply With Quote
  #2  
Old 04-05-2005, 01:49 PM
NateO's Avatar
NateO NateO is offline
Excellent…

Forum Leader
* Expert *
 
Join Date: Jun 2004
Location: Minneapolis MN - deceased
Posts: 2,483
Default

Hello,

As in IE's not ready? How about something like the following:

Code:
Public Declare Function ShowWindow& Lib "user32" ( _ ByVal hwnd As Long, _ ByVal nCmdShow As Integer) Sub tester() Dim ie As Object On Error GoTo errHandle Set ie = CreateObject("InternetExplorer.Application") With ie .navigate "http://www.xtremevbtalk.com" Do While .busy: DoEvents: Loop Do While .ReadyState <> 4: DoEvents: Loop .Visible = True Call ShowWindow(.hwnd, 3) 'Maximize .Refresh End With Set ie = Nothing Exit Sub errHandle: MsgBox Err.Description Set ie = Nothing End Sub
__________________
Regards,
Nate Oliver
Microsoft Excel MVP
Reply With Quote
  #3  
Old 04-05-2005, 04:03 PM
Mabsey Mabsey is offline
Regular
 
Join Date: Feb 2005
Posts: 66
Default

Quote:
Originally Posted by NateO
Hello,

As in IE's not ready? How about something like the following:

Code:
Public Declare Function ShowWindow& Lib "user32" ( _ ByVal hwnd As Long, _ ByVal nCmdShow As Integer) Sub tester() Dim ie As Object On Error GoTo errHandle Set ie = CreateObject("InternetExplorer.Application") With ie .navigate "http://www.xtremevbtalk.com" Do While .busy: DoEvents: Loop Do While .ReadyState <> 4: DoEvents: Loop .Visible = True Call ShowWindow(.hwnd, 3) 'Maximize .Refresh End With Set ie = Nothing Exit Sub errHandle: MsgBox Err.Description Set ie = Nothing End Sub
I think I need to explain my routine.

Basically the routine loads five orders pages at a time. When a user submits the first order, I switch to window two that has the second order to process, and so on and so on. Now I have a timer, so in the background, its scanning the order pages, but occasionally an order page will time out with a page cannot be displayed error. Now when timer routine finds this error, it knows the order hasn't been sent, so issues a IE.REFRESH command on that page. So when the user gets back to that page and thinks they are going to put another order in, in fact they get the white page with a Retry or Cancel asking them, do they want to submit the information. This is the part I want to make transparent? The Part where IE says, "This page cannot be refreshed without resending the information, do you want to resend, rery, cancel"

Also I really like the createobject routine above, but I find it doesn't handle site cookies very well. Each order I process has a differnt cookie, but if I open 5 IE Object windows, it seems to share one cookie for all 5 windows? and doesn't create 5 individual cookies, if that makes sense.

Mabsey
Reply With Quote
  #4  
Old 04-06-2005, 01:59 PM
NateO's Avatar
NateO NateO is offline
Excellent…

Forum Leader
* Expert *
 
Join Date: Jun 2004
Location: Minneapolis MN - deceased
Posts: 2,483
Default

Hello,

Hmmm, timers don't sound too good, at least in terms of predicting when you're up and running on site, they make some sense for bailing all together.

The sight times out on you? If so, when you complete the following:
Code:
Do While .busy: DoEvents: Loop Do While .ReadyState <> 4: DoEvents: Loop
Test that the page hasn't timed out (innerText).

Otherwise, I would say use one instance of IE and go through this process linearly, e.g., order 1, order 2, etc... Versus combobulating it all together at once.

Quote:
Also I really like the createobject routine above, but I find it doesn't handle site cookies very well.
Why wouldn't it? In any case, log in and out as you find you need to, you should be able to test for this (see the above) without relying on a website to do the work for you. In fact, this would be risky, websites tend to be very dynamic, your code should be too.
__________________
Regards,
Nate Oliver
Microsoft Excel MVP
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->