Solved

Open the favorite webbrowser from VB

Posted on 1999-01-08
4
157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

717 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