array and shell

  • Thread starter James L Szatkowski, PE
  • Start date
J

James L Szatkowski, PE

I'm using (successfully in VB Express) this routine:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
http://www.microsoft.com", AppWinStyle.MinimizedNoFocus, True)

Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
http://www.yahoo.com",
AppWinStyle.MinimizedNoFocus, True)

Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
http://www.google.com",
AppWinStyle.MinimizedNoFocus, True)

End Sub

However, I'd like to

1) input an array of URL's and sequence through the URL's one at at time.

Right now this routine opens the first and stops until I close it, then
opens the second waiting again until I close it and then opens the third
window (instance) of IE.

I really want it

2) to load the first URL completely, then open the second URL in the same
window in place of the 1st, then 2nd URL, etc.).

Gotta be something simple... I just don't see an example anywhere



Thanks!
Jim
 
B

Branco Medeiros

I'm using (successfully in VB Express) this routine:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
http://www.microsoft.com", AppWinStyle.MinimizedNoFocus, True)

Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
http://www.yahoo.com",
AppWinStyle.MinimizedNoFocus, True)

Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
http://www.google.com",
AppWinStyle.MinimizedNoFocus, True)

End Sub

However, I'd like to

1) input an array of URL's and sequence through the URL's one at at time.

Right now this routine opens the first and stops until I close it, then
opens the second waiting again until I close it and then opens the third
window (instance) of IE.

I really want it

2) to load the first URL completely, then open the second URL in the same
window in place of the 1st, then 2nd URL, etc.).
<snip>

I'm affraid you'll have to give up the (apparent) simplicity of your
approach and consider dealing with InternetExplorer the COM object,
exposed by the Microsoft Internet Controls COM library (shdocvw.dll).

Something in the ways of:

<aircode>
Private WithEvents IE As SHDocVw.InternetExplorer
Private mPageIndex As Integer
Private mPages() As String = { _
"www.google.com", "www.microsoft.com", "www.digg.com" _
}

Private Sub NextPage()
'Navigates to page pointed by mPages(mPageIndex) and then increments
'mPageIndex

If mPageIndex < 0 OrElse mPageIndex >= mPages.Length Then Return
Dim URL As String = mPages(mPageIndex)
mPageIndex += 1

If IE Is Nothing Then IE = New SHDocVw.InternetExplorer
IE.Visible = True
IE.Navigate2(URL)
End Sub

Private Sub IE_DocumentComplete(...) _
Handles IE.DocumentComplete
'When the pages finishes showing, move on to the next page
'(Yikes!)
NextPage()
End Sub
</aircode>

HTH.

Regards,

Branco.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top