Solved

Open New Internet Explorer Window

Posted on 2002-07-12
8
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 143

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
Webinar: MongoDB® Index Types

Join Percona’s Senior Technical Services Engineer, Adamo Tonete as he presents “MongoDB Index Types, How, When and Where Should They be Used?” on Wednesday, July 12, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7).

 
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
 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
Suggested Courses

628 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