Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I handle Cached info in Internet Explorer Control

Status
Not open for further replies.

Zacko

Technical User
Joined
Jan 22, 2005
Messages
7
Location
GB
Oh I'm not a serious programmer and have the following problem with new instances of Internet Explorer.

Here's my code :

Dim IE1 As New InternetExplorer
Dim IE2 As New InternetExplorer

Private Sub Command1_Click()
IE1.ToolBar = False
IE1.MenuBar = False
IE2.ToolBar = False
IE2.MenuBar = False
IE1.Navigate "IE2.Navigate "End Sub

Now two internet explorer windows pop up and display a grid with a number to click. The trouble is, both the numbers are the same in each window. One of them is correct, and the other seems to be cached or something cause I get a misclick when I click it. How can I solve it so that each page is a complete fresh load, with its own cookie? Is this possible.

Many Thanks in advance.

Zacko
 
From MSDN help file:
Code:
object.Navigate URL [[red]Flags[/red],] [TargetFrameName,] [PostData,] [Headers]


Flags Optional. A constant or value that specifies whether to add the resource to the history list, whether to read from or write to the cache, and whether to display the resource in a new window. It can be a combination of the following constants or values: 
[b]navOpenInNewWindow[/b] 1 Open the resource or file in a new window. 

[b]navNoHistory[/b] 2 Do not add the resource or file to the history list. The new page replaces the current page in the list. 

[b]navNoReadFromCache[/b] 4 Do not read from the disk cache for this navigation.
 
[b]navNoWriteToCache[/b] 8 Do not write the results of this navigation to the disk cache.
I must be missing something, because I couldn't use the defined constants, but you can use the values just as well.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
I have tried adding flags but it don't seem to make a difference.

Here's the code :-

Dim Flag1 as Integer
Dim Flag2 as Integer
Dim IE1 As New InternetExplorer
Dim IE2 As New InternetExplorer

Private Sub Command1_Click()
Flag1 = 4
Flag2 = 4
IE1.ToolBar = False
IE1.MenuBar = False
IE2.ToolBar = False
IE2.MenuBar = False
IE1.Navigate " Flag1
IE2.Navigate " flag2
End Sub

I know the above is long winded but I'm keeping it simple to show the point.

When I click command1, the two IE windows appears and the numbers in the box are still the same even with the flag set to 4. Am I missing something obvious here?

Many Thanks for the reply so far

Zacko
 
Whatever your problem is, it isn't with the navigate. I get the same problem when I click on those two links above and open them in my own browser windows. They both have the word "one", although the first is "one" and the second is "onE". When I click on 1 in the first it works fine. When I click on 1 in the second I get the "sorry" page. Your problem appears to be in the page itself, not the VB program.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Could it be that the two windows are sharing the same cookie? With each Page you load it should have its own cookie, cause the way that site works is, You are only allowed to click the same person once in 24 hours so it does two things.

1) The site logs your IP
2) The site puts a cookie on your machine with every page

I'm wondering if the two browser windows are sharing the same cookie or something?

If I open up two internet explorer windows, I can click them both fine, this only does this when I launch the windows from within VB.

Zacko
 
If the two pages have the same domain name and store the same cookie name, then it will be a shared cookie. I don't see any way around that unless you arrange for the cookies to be named differently. I just clicked to two links you posted in the message above and got the problem I (and you) described.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Now I've thought about doing this another way using Shell:-

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Dim WP(0 To 25) As Long

For x = 1 To Text1
Webpag = "C:\PROGRAM FILES\INTERNET EXPLORER\iexplore.EXE
WP(x) = Shell(Webpag, vbMaximizedFocus)
Next x

So in text1 I can type the number two, and two versions of IE will load with the correct numbers and can be clicked with no problems.

To switch to the windows I can use

AppActivate WP1

And I will make the links read from a variable to.

But this poses another problem. How can I grab the innerHTML of the two Shelled windows. Efectivley they seem Orphaned now although I can switch to them.

With the routine in my first message I can use this :

wptext = IE1.Document.body.innerhtml

Not sure how I would do this with my new example?

Thanks for taking the time to reply so far.

Zacko
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top