Results 1 to 7 of 7

Thread: How do you call a .hlp file from a menu click?

  1. #1
    Guest

    Question

    I created a help file with Microsoft Help Workshop that shipped with VB5.
    I'm having difficulites appling it to my app.

    How do I call my help file from a menu click? (i.e. I have a menu called
    help, with a sub menu called topics) I'd like for the help file to pop up
    when that is clicked.

  2. #2
    Guest
    Code:
    Public Declare Function RunFile 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
    
    'Open Help File
    RunFile Me.Hwnd, "open", "C:\Your\HelpFile\Path\And.Name", vbNull, "C:\Your\" _
    "Help\File\Path\", 0
    Also, you can use CommonDialogs. You will have to research that yourself.

  3. #3
    Guest
    Hi

    Place a CommonDialog control on a form together with 2 commands, Command1(0) and Command1(1) and insert this code:
    Command1(0) for opening index and command1(1) for opening contect in your help file

    Private Sub Command1_Click(Index As Integer)
    App.HelpFile = "YourHelpFile.hlp" ' F1 can open the help file
    CommonDialog1.CancelError = True
    On Error GoTo ErrHandler
    ' Set the HelpCommand Property
    CommonDialog1.HelpCommand = cdlHelpForceFile
    ' Specify the Help file.
    CommonDialog1.HelpFile = App.HelpFile
    Select Case Index
    Case 0
    CommonDialog1.HelpCommand = &H101&
    Case 1
    CommonDialog1.HelpCommand = &H3&
    End Select
    ' Display the Windows Help engine.
    CommonDialog1.ShowHelp
    Exit Sub
    ErrHandler:
    ' User pressed Cancel button.
    Exit Sub
    End Sub

    This should work

    Jorgen

  4. #4
    Guest

    Unhappy CommonDialog Control

    What is a CommonDialog Control?

  5. #5
    Guest
    The CommonDialog control provides a standard set of dialog boxes for operations such as opening, saving, and printing files or selecting colors and fonts.

    To use: Click Project > Components > Microsoft Common Dialog Control 6.0 (or whatever version you have)

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I recommend the ShellExecute api, don't use a control if there's an easy way around!

    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  7. #7
    Guest
    If you want to have the files opened with WinHelp, I recommend against ShellExecute because it will open the file with it's default App (people might have the *.hlp files associated with another App). Use standard Shell method instead.
    Code:
    Shell "WINHELP.EXE C:\MyHelpFile.hlp", 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width