|
-
Jul 4th, 2000, 09:43 AM
#1
Thread Starter
Lively Member
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
-
Jul 4th, 2000, 09:49 AM
#2
PowerPoster
Use the ShellExecute API command
-
Jul 4th, 2000, 02:37 PM
#3
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")
-
Jul 4th, 2000, 02:50 PM
#4
Junior Member
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.
-
Jul 4th, 2000, 04:23 PM
#5
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|