HELP!! - Opening Browser in a NEW Window

in visual basic
is there anyway to open the default browser in a NEW window?
instead of opening in an already open window [if there is one open].
thanks
please email me at: irsnort@hotmail.com
irsnortAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JaganMohanConnect With a Mentor Commented:
Try this code
Option Explicit
Const SW_SHOWNORMAL = 1 ' Restores Window if Minimized or

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 As String, Dummy As String
    Dim BrowserExec As String * 255
    Dim RetVal As Long
    Dim FileNumber As Integer
   
    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>" ' 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 a browser"

      Else
        RetVal = ShellExecute(Me.hwnd, "Open", BrowserExec, _
          "www.oracle.com", Dummy, SW_SHOWNORMAL)
        If RetVal <= 32 Then ' Error
          MsgBox "Web Page not Opened"
        End If
      End If

    Kill FileName ' delete temp HTML file
End Sub
0
 
irsnortAuthor Commented:
thanks, what i was lookin for
im using vb3 and forgot to add that but ive changed the code a lil bit and its what i need
thanks agian
0
All Courses

From novice to tech pro — start learning today.