Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

Calling a Help File

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
CraigLazar
Asked:
CraigLazar
  • 2
1 Solution
 
trilloCommented:
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
 
CraigLazarAuthor Commented:
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
 
trilloCommented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now