Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calling a Help File

Posted on 1998-12-07
3
Medium Priority
?
163 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 120 total points
ID: 1448549
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
ID: 1448550
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
ID: 1448551
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

Industry Leaders: 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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

971 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