Solved

Open New Internet Explorer Window

Posted on 2002-07-12
8
178 Views
Last Modified: 2010-05-02
how can i programmatic browse to a specific web page in a NEW Internet Explorer window even if the user has there IE settings set to reuse IE windows?
0
Comment
Question by:Jambyte
8 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7148480
I use this code, which opens a new IE for me, even as i have configured to reuse IE windows:

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
               
Private Const SW_SHOW = 1

Private Sub Navigate(ByVal NavTo As String)
  Dim hBrowse As Long
  hBrowse = ShellExecute(0&, "open", NavTo, "", "", SW_SHOW)
End Sub


CHeers
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7148500
try this:

In windows 2000:-

Privat Sub command1_click()
Call Shell("C:/Program Files/Internet Explorer/iexplore.exe http://www.experts-exchange.com", vbNormalFocus)
End Sub

In others(like windows NT) etc

Privat Sub command1_click()
Call Shell("c:/program Files/Plus!/Microsoft Internet/iexplore.exe http://www.experts-exchange.com", vbNormalFocus)
End Sub

Hope this helps!

-priya


0
 
LVL 2

Author Comment

by:Jambyte
ID: 7148580
angelIII, your code seems to be the most elegent but it doesn't open a new window if reuse current IE window is enabled in windows xp IE6.

priya_pbk, is there a way to make new window be in front, be active, or have focus know what i mean?
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7148617
Actually speaking, I did not have a good read at your question. I had just read the headline qt in the main page.

Again, the above code was for opening IE programatically thru vb (which i thought you wanted)!


if so, change the second parameter to "vbMinimizedFocus" instead of "vbNormalFocus", will this help!

-priya
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 28

Expert Comment

by:AzraSound
ID: 7148989
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate strURL
0
 

Expert Comment

by:itmelo
ID: 7149259
I found this code in Microsoft's Knowledge Database some time ago and I use it quite a bit. It opens a new browser window even if others are open.

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q174156

Give it a try...

Private Const SW_SHOW = 5 ' Displays Window in its current size and position
Private Const SW_SHOWNORMAL = 1 ' Restores Window if Minimized or Maximized

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

Private Declare Function FindExecutable Lib "shell32.dll" Alias _
         "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As _
         String, ByVal lpResult As String) As Long

Private Sub Command1_Click()
      Dim FileName, Dummy As String
      Dim BrowserExec As String * 255
      Dim RetVal As Long
      Dim FileNumber As Integer

      ' First, create a known, temporary HTML file
      BrowserExec = Space(255)
      FileName = "C:\temphtm.HTM"
      FileNumber = FreeFile                    ' Get unused file number
      Open FileName For Output As #FileNumber  ' Create temp HTML file
          Write #FileNumber, "<HTML> <\HTML>"  ' Output text
      Close #FileNumber                        ' Close file
      ' Then find the application associated with it
      RetVal = FindExecutable(FileName, Dummy, BrowserExec)
      BrowserExec = Trim(BrowserExec)
      ' If an application is found, launch it!
      If RetVal <= 32 Or IsEmpty(BrowserExec) Then ' Error
          MsgBox "Could not find associated Browser", vbExclamation, _
            "Browser Not Found"
      Else
          RetVal = ShellExecute(Me.hwnd, "open", BrowserExec, _
            "www.microsoft.com", Dummy, SW_SHOWNORMAL)
          If RetVal <= 32 Then        ' Error
              MsgBox "Web Page not Opened", vbExclamation, "URL Failed"
          End If
      End If
      Kill FileName                   ' delete temp HTML file
End Sub
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8002363
Hi Jambyte,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

    *** NOTE: I thought that angelIII's techniqye should work, but if it doesn't than maybe AzraSound's  will also fail.  Can anyone say for sure?

Jambyte, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8095354
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now