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
Solved

simple question

Posted on 2003-12-06
7
305 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

789 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