Solved

simple question

Posted on 2003-12-06
7
312 Views
Last Modified: 2010-04-17
how can I load an html page named help.html in a browser window when I press a button named Help_btn in my visual basic program ?
0
Comment
Question by:oostwijk
7 Comments
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 9890839
try:

Ret& = ShellExecute(0, "open", "c:\help.htm", "", vbNull, SW_SHOWNORMAL)
or
Ret& = ShellExecute(0, "open", "www.google.com", "", vbNull, SW_SHOWNORMAL)
0
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 9890846
Private Sub Help_btn_Click()
Ret& = ShellExecute(0, "open", "www.google.com", "", vbNull, SW_SHOWNORMAL)
End Sub

Rajesh
0
 
LVL 24

Accepted Solution

by:
R_Rajesh earned 50 total points
ID: 9890866
well i forgot to list the function

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 Sub Help_btn_Click()
Ret& = ShellExecute(0, "open", "www.google.com", "", vbNull, SW_SHOWNORMAL)
End Sub
0
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!

 

Author Comment

by:oostwijk
ID: 9891809
Hi Rajesh,

It works fine when I use the line :
Ret& = ShellExecute(0, "open", "www.google.com", "", vbNull, SW_SHOWNORMAL)

However when I want to open a offline html page with:
Ret& = ShellExecute(0, "open", "help.html", "", vbNull, SW_SHOWNORMAL)
it doesn't work..

Can you help me out ?

0
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 9891812
give the full path:

Ret& = ShellExecute(0, "open", "c:\html\help.html", "", vbNull, SW_SHOWNORMAL)



Rajesh
0
 
LVL 6

Expert Comment

by:valipotor
ID: 9892272
Maybe you have to use the file protocol , like this
Ret& = ShellExecute(0, "open", "file://c:\html\help.html", "", vbNull, SW_SHOWNORMAL)

0
 
LVL 4

Expert Comment

by:bhartung
ID: 9915030
If you prefer to have programmatic control over the process rather than just shelling out (so that you can get better error information, for example), you could do this instead:

    Dim oIE As Object
   
    Set oIE = CreateObject("SHDocVw.InternetExplorer")
   
    oIE.Visible = True
   
    oIE.Navigate "http://www.sysinternals.com/"
   
    Set oIE = Nothing

If you prefer to use early binding, the TypeLib to Reference in VB is called "Microsoft Internet Controls".
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

762 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