From: Mayayana on
| Please note that it's an extract of my code not all the code.

OK. But if it's not the real code, and you don't explain
what you're trying to do, then everyone might just waste
each others' time.

| I've tried your idea before getting this monster. The problem is that
when
| you do
| Set web = New InternetExplorer
| if an InternetExplorer is already open, it will use that one not a new one
| (they will have the same PID). So If another process use it, I will close
it
| when I'm finished. That's what I don't want.
|

All instances will have the same PID, but they're
separate instances, identifiable by their hWnd. Each
operates independently. The code below demonstrates
that you can start multiple instances, work with each,
kill one, and not affect the others. Open IE and leave it
open. Then run the code. When you click button 1 you'll
see that all open IE and Explorer windows are listed with
different hWnds and locations in the immediate window.
Among them will be the copy you opened at "about:blank"
and the two instances created, with the file1.html and
file2.html webpages loaded.
When 1 of your coded instances is then killed (the one
that navigated to file1.html) it has no affect on the remaining
IE instances..


'----------------------- code in form with 2 buttons ----------
Option Explicit

Dim IE As InternetExplorer, IE2 As InternetExplorer, IE3 As InternetExplorer

Private Sub Command1_Click()
Dim SW As ShellWindows
Set IE = New InternetExplorer
IE.Navigate "C:\windows\desktop\file1.html"
Do While IE.ReadyState <> 4
Loop
Set IE2 = New InternetExplorer
IE2.Navigate "C:\windows\desktop\file2.html"
Do While IE2.ReadyState <> 4
Loop

Set SW = New ShellWindows
For Each IE3 In SW
Debug.Print IE3.hWnd & " - " & IE3.LocationURL
Next
Set SW = Nothing

IE.Quit '-- quit one of the new IE instances.
Set IE = Nothing

Debug.Print "Second run:"
Set SW = New ShellWindows
For Each IE3 In SW
Debug.Print IE3.hWnd & " - " & IE3.LocationURL
Next
Set SW = Nothing
End Sub

Private Sub Command2_Click()
IE2.Quit
Set IE2 = Nothing
End Sub


First  |  Prev  | 
Pages: 1 2
Prev: Using a typelib
Next: Shell ???