Results 1 to 7 of 7

Thread: VB & *.chm files

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    Wolverhampton, England
    Posts
    218

    VB & *.chm files

    Does any of you intelligent people know how to link a html help compiled filed (.chm) into a vb project?

    If i have a cmdHelp button how would i call the already created .chm file?

    Any ideas??

    Please

    Please!!

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Code:
    Private Declare Function ShellExecute 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
    
    Const SW_SHOWNORMAL = 1
    
    Private Sub Command1_Click()
        ShellExecute Me.hwnd, vbNullString, "C:\WINNT\Help\access.chm", _
        vbNullString, "C:\", SW_SHOWNORMAL
    End Sub

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    you can link the chm file under your project's properties.

    you can also make the chm help file context sensitive.
    then once you've done that, you can specifiy help context ID's in your forms, and on your buttons etc.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    Wolverhampton, England
    Posts
    218
    cheers, this works.........but how would i be able to open the help file at a specific point??

    Say for example i have ten vb forms all of which have separate .htm files in the compiled help project. how would i associate each form with each separtae .htm file??


    is it something to do with the helpcontextID property??

  5. #5
    Junior Member
    Join Date
    Sep 2001
    Location
    UK
    Posts
    28
    Maybe something like this

    Private Const HH_DISPLAY_TOPIC = &H0

    Private Declare Function htmlHelpTopic Lib "hhctrl.ocx" _
    Alias "HtmlHelpA" (ByVal hwnd As Long, _
    ByVal lpHelpFile As String, _
    ByVal wCommand As Long, _
    ByVal dwData As String) As Long

    and then

    Private Sub Command11_Click()
    Topic "Logon.htm"
    htmlHelpTopic 0, "\\RESRSREDLION002\acl_pd$\People Development Database\PD DB.chm", HH_DISPLAY_TOPIC, File
    End Sub

    where file is the specific htm file you want to view.

    This is from my access 97 database but it might work for you.

  6. #6
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    Originally posted by karolmcauley
    cheers, this works.........but how would i be able to open the help file at a specific point??

    Say for example i have ten vb forms all of which have separate .htm files in the compiled help project. how would i associate each form with each separtae .htm file??


    is it something to do with the helpcontextID property??
    spot on.

    you create the context ID when designing your help file (how - depends on what you used to make your help file).

    You then specifiy a context ID for each form/control etc that you want. then when they press F1 on that control/form it will jump to the relevant page ...
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    Wolverhampton, England
    Posts
    218
    Originally posted by darre1


    spot on.

    you create the context ID when designing your help file (how - depends on what you used to make your help file).

    You then specifiy a context ID for each form/control etc that you want. then when they press F1 on that control/form it will jump to the relevant page ...

    I am only a recent grad in vb so forgive me for my stupidity! But if i am using HTML Help workshop (downloadable from microsoft), how do you specify a context ID in this when designing your help files?

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