Results 1 to 5 of 5

Thread: Opening a new web-page window

  1. #1

    Thread Starter
    Lively Member tonnic's Avatar
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    107

    Opening a new web-page window

    Hi everybody,

    I got this code:

    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 Sub Command1_Click()
    ShellExecute 0&, vbNullString, "http://www.google.com", vbNullString, "C:\", 1
    End Sub


    and it works, but it replaces my last web-browser window, and I want to let it open in a new window...

    anyone?





    and while your reading this: how do you rename a file using vb?
    Last edited by tonnic; Mar 10th, 2002 at 12:33 PM.

  2. #2

    Thread Starter
    Lively Member tonnic's Avatar
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    107

    Post

    common, it aint such a hard question ?

  3. #3

    Thread Starter
    Lively Member tonnic's Avatar
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    107
    6 hours and still nobody posted???

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Originally posted by tonnic
    common, it aint such a hard question ?
    So you're just testing to see if we can do it?

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
    4.  
    5. Private Function GetBrowserEXE() As String
    6.     Dim iFile As Integer
    7.     Dim sEXE As String
    8.    
    9.     iFile = FreeFile
    10.     Open "C:\~Temp.htm" For Output As iFile
    11.     Close iFile
    12.    
    13.     sEXE = Space(255)
    14.     Call FindExecutable("C:\~Temp.htm", "", ByVal sEXE)
    15.     Kill "C:\~Temp.htm"
    16.    
    17.     If InStr(sEXE, Chr(0)) Then GetBrowserEXE = Left(sEXE, InStr(sEXE, Chr(0)) - 1)
    18. End Function
    19.  
    20. Private Sub OpenInNewBrowser(ByVal sURL As String)
    21.     Call Shell(GetBrowserEXE() & " " & sURL, vbNormalFocus)
    22. End Sub
    23.  
    24. Private Sub Command1_Click()
    25.     Call OpenInNewBrowser("http://www.vbforums.com")
    26. End Sub

  5. #5

    Thread Starter
    Lively Member tonnic's Avatar
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    107
    thanks, it works!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width