
ShellExecute only opens file.htm if browser already open
Since you try to open a htm file, you can try OpenNew verb to open a new IE
window. For example:
ShellExecute Me.hwnd, "opennew", mfile, vbNullString, vbNullString, 3
Sincerely,
Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Newsgroups: microsoft.public.vb.com
| Subject: ShellExecute only opens file.htm if browser already open
| Date: 22 Jan 2003 14:39:48 -0800
for-mail
| Xref: cpmsftngxa08 microsoft.public.vb.com:33331
| X-Tomcat-NG: microsoft.public.vb.com
|
| I use VB6 and Windows 2000.
|
| When I double-click file.htm in Windows Explorer it opens in the
| default browser (which is Internet Explorer 5).
|
| However, when I use ShellExecute to do the same thing, it only opens
| if the browser is already open in another window.
|
| Here is my code:
|
| Public 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 mnunewmediaviewhelp_Click()
| On Error GoTo err
| Dim mapp As String
| Dim mfile As String
| mapp = App.path
| If Right(mapp, 1) <> "\" Then mapp = mapp + "\"
| mfile = mapp + "help.htm"
| ShellExecute Me.hwnd, "open", mfile, vbNullString, vbNullString, 3
| Exit Sub
| err:
| MsgBox err.Description & " NewMediaView Help"
| End Sub
|
| Any help is greatly appreciated.
|
| Sincerely,
|
| Jan Nordgreen
|