Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 10th, 2005, 04:41 AM
Authorized User
 
Join Date: Mar 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTML Help

I want do display HTML Help(.chm) when press an Button.
How can do this?
 
Old April 10th, 2005, 12:58 PM
Authorized User
 
Join Date: Apr 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here you go:

First Create your chm file (i persume you know how)

Then Create a new .bas module, i call it modHelpFiles.bas

Here is sample code:

'================================================= =====
'Module Start:
'================================================= =====
Option Explicit

Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" _
                          (ByVal hwndCaller As Long, _
                          ByVal pszFile As String, _
                          ByVal uCommand As Long, _
                          dwData As Any) As Long

'Add these they are defaults:
Public Const HH_DISPLAY_TOPIC = &H0
Public Const HH_HELP_CONTEXT = &HF

'This is your own constants for defining each helpfile name
'Note that the helpfile name i.e. "Allocations" is the actual
'name of the html file added to the chm project.
'If you selected that chm must compile the folders then it's
'critical to also add the folder before the name
'i.e. \UserInformation\UserSetupPage or as done in the function
'Showhelp below it makes it "HTML_Files\" & file name & ".html"
Public Const HF_ALLOCATIONS = "Allocations"
Public Const HF_ACCOUNTS = "Accounts"
Public Const HF_LOGIN = "Login"

'/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Public Sub ShowHelpFile(ByVal strFileName As String)
'/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
  On Error GoTo ShowHelpFile_ERR
  Call HtmlHelp(0, App.Path & "\MyAppName.chm", HH_DISPLAY_TOPIC, _
                ByVal "HTML_FILES\" & strFileName & ".htm")
Exit Sub
ShowHelpFile_ERR:
  MsgBox "[" & Err.Number & "] " & _
Err.Description, vbInformation, "ShowHelpFile - Error"
End Sub


'================================================= ==
'End Of Module
'================================================= ==

in the form at the help_button its very easy
just add this line of code:

Call ShowHelpFile(HF_LOGIN)

Note HF_Login refers the the file i want displayed.

Regards and shout if you need more help



Helga Anagnostopoulos
 
Old April 11th, 2005, 04:10 AM
Authorized User
 
Join Date: Mar 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The HTML Help file will Open, BUT on the first page when open write "The page cannot be displayed". And if select one element from the left sreen he display it whell.
Why not display from the first time?
 
Old April 13th, 2005, 06:46 AM
Authorized User
 
Join Date: Jan 2005
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JelfMaria
Default

try using MS internet explorer reference object






Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove orphaned html elements from html string pauliehaha C# 2008 aka C# 3.0 2 June 30th, 2008 09:40 AM
html:errors and html:messages sparun1607 Struts 0 November 23rd, 2006 08:34 AM
Converting an HTML Server Control to HTML Control gratisaccount ASP.NET 1.0 and 1.1 Basics 2 August 7th, 2006 12:29 AM
Can you preload child html files to 1parent html? bekim Javascript How-To 4 January 22nd, 2005 04:17 PM
html Moharo HTML Code Clinic 3 August 16th, 2003 12:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.