Solved

Open the favorite webbrowser from VB

Posted on 1999-01-08
4
141 Views
Last Modified: 2010-05-03
This is probably a common question. I want to be able to open HTML-documents in the user's webbrowser. To make it a little harder for you, experts, I want to make sure that a 4.0 browser from Netscape or Microsoft is used. How can I achieve this?
0
Comment
Question by:liljegren
  • 2
4 Comments
 

Author Comment

by:liljegren
ID: 1454907
Edited text of question
0
 
LVL 1

Expert Comment

by:bear454
ID: 1454908
And what do you do if the user does not have a 4.x browser installed?
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 50 total points
ID: 1454909
Here is how to execute a html file.
To verify whether or not version4 is installed is a completly other question.

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 Declare Function GetDesktopWindow Lib "user32" () As Long
Private Const SW_SHOWNORMAL = 1
  

     'Description:How do I launch a file in its associated program?

Function StartDoc(DocName As String) As Long

       Dim Scr_hDC As Long
       Scr_hDC = GetDesktopWindow()
       StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", "C:\", SW_SHOWNORMAL)
End Function
  
Private Sub Form_Click()
       Dim r As Long
       r = StartDoc("c:\myhtml.html")
       Debug.Print "Return code from Startdoc: "; r
End Sub

0
 

Author Comment

by:liljegren
ID: 1454910
That was a piece of useful code. Guess I have to make another question on the 4.0 issue. The program generate HTML documents. If the user doesn't have a 4.0 browser, the program should generate a HTML 3.2 document with <FONT> tags, instead of the HTML 4.0 + CSS document.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now