#1
  1. No Profile Picture
    php newbie
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    544
    Rep Power
    38

    Open URL in Window


    Hi,
    I'm new to VB so this might seem like a simple question. Someone on my site enters a URL in a form box, all i want it to do is open that URL in a new browser window.

    <img src="http://img.villagephotos.com/p/2003-6/226576/form1.gif" width=432 height=81>

    So far i have no command functions.

    Code:
    Private Sub Command1_Click()
    End Sub
    
    Private Sub Text1_Change()
    End Sub
    Can someone help me with this please?

    Thanks.
    "They have the internet on computers now" - Homer
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    10
    Rep Power
    0
    Here you go
    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

    Public Sub Navigate(ByVal NavTo As String)

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

    Private Sub Command1_Click()
    Navigate ("http://img.villagephotos.com/p/2003-6/226576/form1.gif")
    End Sub
  4. #3
  5. No Profile Picture
    php newbie
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    544
    Rep Power
    38
    Sorry, i make a mistake by putting <img src="http://img.villagephotos.com/p/2003-6/226576/form1.gif" width=432 height=81>
    in the question. This was just an image of the form box i was using, which is at http://img.villagephotos.com/p/2003-6/226576/form1.gif.

    Its basically a text input box and a command button. From there i want to open the url in the window. And is it possible to do this without using dlls?

    Thanks.
    "They have the internet on computers now" - Homer
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Actually you should be able to just use the Shell() function.

    i.e.
    Code:
    Shell("c:/program files/internet explorer/iexplore.exe http://www.site.com/page/to/load")

IMN logo majestic logo threadwatch logo seochat tools logo