Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a web page from VB6

Status
Not open for further replies.

spamjim

Instructor
Mar 17, 2008
1,368
US
What's the best way to open a web page from VB6 today? We have a command from our program's Help menu to open a HTML help document.

We had a ShellExecute command but recent Windows security updates appear to block that method.

Our developer is now proposing a solution...
Code:
CreateObject("internetexplorer.application")

However, IE is dying (if not already dead). We should open the default browser instead. Are there any suggestions how to do this?
 
You may find it useful. Just pass either URL or a valid Path with document name and you can open it in the default application:

Code:
Option Explicit

Private Sub Command1_Click()
Call OpenDocument([red]"www.google.com"[/red])
End Sub
[blue]
Public Sub OpenDocument(strDocPath As String)
Dim G As Long
G = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & strDocPath, vbNormalFocus)
End Sub
[/blue]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Thanks. We're still having issues and I think it involves "Shell". I cannot tell if this is the result of a Windows system update or if the company's IT department has applied a policy to block this. I can run all of these options in the Windows Server 2008 VM where we have installed VB6 IDE. However, as soon as I take the EXE to another system (Win 7/10) it fails.
 
The code I gave you runs OK on my VB6 on Windows10

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
You can try and shell NotePad.exe and see if it opens up. That would rule out the issue is accessing the web.
 
You can check if it is an issue with launching from VB by opening a command prompt and trying

[tt]explorer "[/tt]

and see if that works
 
Following up...

This appears to have been a temporary bug with a Windows update or with an update to Sophos security software (common to all tested systems). Today, without any changes to the VB6 program, it is back to behaving as expected. Windows and Sophos software have received automatic updates since the original post.

Thanks for the troubleshooting ideas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top