Solved

Calling a Help File

Posted on 1998-12-07
3
155 Views
Last Modified: 2010-05-03
Hi
I am using VB3 and i need to know how to call my help file i have created for my application
I have a menu cammand called Help
in the help procedure i placed this code
CMDialog1.HelpFile = "c:\dial\dial.hlp"
CMDialog1.HelpCommand = cdlHelpContents
CMDialog1.ShowHelp  ' Display Visual Basic Help contents topic.

i placed a common dialog control on the form
this works perfectly in VB5 but in VB3 it gives me an error "Type mismatch" on line 3
it does not like  CMDialog1.ShowHelp

please help
thanx craig
0
Comment
Question by:CraigLazar
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 30 total points
Comment Utility
Why dont you use the WinHelp function, It's easier and you don't need the DialgoBox control to be there.

This is the 32bit declaration, but look in your API text viewer for the correct declaration at VB3.
Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
Parameters:
hwnd: Handle of the window requesting help.
lpHelpFile: string with the path and name of the helpfile
wCommand: (See below)
dwData: Depends on wCommand

Values for wCommand
HELP_CONTENTS = Displays the contents of the help file. dwData is ingored.
HELP_CONTEXT = Displays a specific topic, where the topicID is defined with the dwData parameter.
HELP_HELPONHELP      = Displays how to use windows help. dwData is ingored.
HELP_INDEX = Displays the index. dwData is ingored.

You can find the values for these constants at the API text viewer.

Trillo
0
 
LVL 4

Author Comment

by:CraigLazar
Comment Utility
Hi T
Thanx for your response and i appologize for not getting back to u sooner i am on three projects at once .
anyway
i found the vb3 version of winhelp
could you help on clearing up the first parameter for me hwind
sais it is a handle to the form i want to place it in the main form , is this write ?
then is it possible to call my help file from the menu.(So it displays the help file)

this is what i have so far
"my declare is "
Declare Function WinHelp Lib "User" (ByVal hwnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, dwData As Any) As Integer
Dim temphelp As Integer


"this is in form load"
temphelp = user("c:\dial\dial.hlp", help_contents)

thanx mate
C
0
 
LVL 2

Expert Comment

by:trillo
Comment Utility
The hwnd parameter is the handle of the Help file's owner window. This means that you can assign a "parent" window for hte Help file, so when you are displaying the help file of your app, if you close your program, your help file will be closed too.

For example, place this in response to some button or menu:

Call WinHelp(Me.hwnd, "c:\dial\dial.hlp", HELP_CONTENTS, 0)

Note that the functions is "WinHelp"... (not "user".. user is the name of the DLL where the "WinHelp" function resides)
Note also that you have to declare the HELP_CONTENTS variable, you should copy this, and the other values form the API text viewer, from the Constants section... (Note that they are all uppercase) I'll post them to you here, but I copied these from the VB4 API text viewer, so there are maybe some of them that weren't availabel in VB3

Public Const HELP_COMMAND = &H102&
Public Const HELP_CONTENTS = &H3&
Public Const HELP_CONTEXT = &H1          '  Display topic in ulTopic
Public Const HELP_CONTEXTPOPUP = &H8&
Public Const HELP_FINDER = &HB
Public Const HELP_FORCEFILE = &H9&
Public Const HELP_HELPONHELP = &H4       '  Display help on using help
Public Const HELP_INDEX = &H3            '  Display index
Public Const HELP_KEY = &H101            '  Display topic for keyword in offabData
Public Const HELP_MULTIKEY = &H201&
Public Const HELP_PARTIALKEY = &H105&
Public Const HELP_QUIT = &H2             '  Terminate help
Public Const HELP_SETCONTENTS = &H5&
Public Const HELP_SETINDEX = &H5         '  Set current Index for multi index help
Public Const HELP_SETWINPOS = &H203&


Trillo
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now