Results 1 to 5 of 5

Thread: Lauching IE with a URL

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Glasgow, Scotland
    Posts
    71
    Should be easy but I can't find it,

    Any ideas how to lunch Internet Expoler with a URL from a VB6 code, I do not want to use and of the activeX controls I have filled a list box with my URL's and want to run them from the double click event.

    Thanks for any help,

    Chris

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Use the ShellExecute API command

  3. #3
    Guest
    There are two ways:

    Code:
    (1):
    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
    
    Public Const SW_SHOWNORMAL = 1
    Public Const SW_ShowMinimized = 2
    Public Const SW_SHOWMAXIMIZED = 3
    Public Const SW_Hide = 0
    Public Const SW_MAX = 10
    Public Const SW_MAXIMIZE = 3
    Public Const SW_MINIMIZE = 6
    Public Const SW_NORMAL = 1
    
       Function ShellToBrowser%(frm As Form, ByVal url$, ByVal WindowStyle%)
             
             Dim api%
                 api% = ShellExecute(frm.hwnd, "open", url$, "", App.Path, WindowStyle%)
          
             'Check return value
             If api% < 31 Then
                 'error code - see api help for more info
                 MsgBox App.Title & " had a problem running your web browser. You should check that your browser is correctly installed. (Error #" & Format$(api%) & ")", 48, "Browser Unavailable"
                 ShellToBrowser% = False
             ElseIf api% = 32 Then
                 'no file association
                 MsgBox App.Title & " could not find a file association for " & url$ & " on your system. You should check that your browser is correctly installed and associated with this type of file.", 48, "Browser Unavailable"
                 ShellToBrowser% = False
             Else
                 'It worked!
                 ShellToBrowser% = True
          
             End If
             
         End Function
    
    'ShellToBrowser(Me,"http://www.site.com",0)
    
    (2):
    
    Public Sub WWWaddress(Address As String)
    '// open up the default web browser and send it to a web page address
    On Error Resume Next
    Dim ReturnVal As Long
    ReturnVal& = Shell("Start.exe " & Address$, 1)
    End Sub
    
    'WWWaddress "http://www.site.com")







  4. #4
    Junior Member
    Join Date
    Feb 1999
    Posts
    24
    you could do all that long crap or..

    call shell("c:\program files\internet explorer\ie.exe" & urltolaunch)

    make sure thats the default path to IE though... i forget it soemtimes.

  5. #5
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Internet Explorer actually supports automation. I think it started with ver. 4.0.
    So, you could do this:
    Code:
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate myURL
    IE.Visible = True
    Of course, you wouldn't want to use this if you're not sure of their version.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

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