Solved

simple question

Posted on 2003-12-06
7
316 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
[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
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
Technology Partners: 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

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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
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.
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 …

710 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