Results 1 to 13 of 13

Thread: Calling a .chm file **SOLVED**

  1. #1

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476

    Angry Calling a .chm file **SOLVED**

    Hey guys, i have a small prob here!

    I am trying to call a .chm file throug the API. I do not get any Error Messages but my helpfile just aint showing, Does anyone see my mistake here?

    VB Code:
    1. Public Helpfile As String
    2. Private Const HH_Display_Topic = &H0
    3. Private Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _
    4. (ByVal hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long
    5.  
    6.  
    7. Private Sub Form_Load()
    8. Helpfile = "Hilfe.chm"
    9. End Sub
    10.  
    11. Private Sub mnu_hilfe_Click()
    12. Call HtmlHelp(0, Helpfile, HH_Display_Topic, ByVal 0&)
    13. End Sub

    Thanx for your help in advance,


    Stephan
    Last edited by Sgt-Peppa; Apr 16th, 2003 at 04:40 AM.
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

  2. #2
    Lively Member blaff's Avatar
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    69
    Put the Helpfile in the same folder as your project and try:

    VB Code:
    1. Private Sub Form_Load()
    2.     Helpfile = App.Path & "\" & "Hilfe.chm"
    3. End Sub
    4.  
    5. Private Sub mnu_hilfe_Click()
    6.     Call HtmlHelp(Me.hwnd, Helpfile, HH_Display_Topic, ByVal 0&)
    7. End Sub
    _____
    blaff

  3. #3

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    Oh boy do I feel stupid now! That was exactly it! Thanx a lot for helping me on that one! Boy, do I hate creating these Help files!


    Thanx again,


    Stephan
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

  4. #4
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    You don't even need an API to open help:
    VB Code:
    1. Private Sub Form_Load()
    2.     Helpfile = App.Path & "\" & "Hilfe.chm"
    3. End Sub
    4.  
    5. Private Sub mnu_hilfe_Click()
    6.     SendKeys "{F1}" 'this will open start page
    7. End Sub
    McGenius

  5. #5

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    You are absolutely right, but I think I have some problems with my help file, everytime I try to open it throug F1, i get a weird message bout my MAP section saying HH_Help_Context called without a map section. Thats why I tried the API thingi, and I do not get any errors there!

    Do you know where my mistake could be?

    Thanx, Stephan

    BTW: Doesn`t VB call the exact same API I did? Wouldnt it be a god idea then to call the Api right away?
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

  6. #6
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    1. I think that error might have occured because you did not assign initial ContextId to your form (btw you'd need to set KeyPreview = True as well).
    2. Most probaly VB does call that same function. Is it better to use API? I'm not sure in this case. I like using API when subclassing is the only way and/or VB cannot do something that will satisfy performance. Otherwise use what's given first. Although, I would use API instead of OCXs such Common Dialog, SysInfo and some others wich are API wrappers anyway but create unnecessary dependencies ...

    Cheers
    McGenius

  7. #7

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    I post my form and my -chm file for you. Could you take a look at it? I just cant find anything i've done wrong here. Just created a test .chm and a test proj.

    pressing F1 makes that mistake pop up, and clicking my menu, makes the same mistake popup and blocks my mouse!

    Thanx, Stephan
    Attached Files Attached Files
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

  8. #8
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I don't get an error at all. It works fine.
    Frans

  9. #9

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    It does?

    I am confused! Heres my error message:
    Attached Images Attached Images  
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

  10. #10
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    It works fine either way for me:
    VB Code:
    1. Private Sub mnuHilfe_Click()
    2.     'Call HtmlHelp(Me.hWnd, Helpfile, HH_Display_Topic, ByVal 0&)
    3.     SendKeys "{F1}"
    4. End Sub
    McGenius

  11. #11
    Lively Member blaff's Avatar
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    69
    Edit: No error from the Menu, but I can confirm the error after pressing F1.

    I changed the HelpContextID of form1 to 0. This solved the problem!

    You could check the HTML-Help-Version (choose version from the system-menu of the help-window).

    My versions:

    HHCTRL.OCX 4.74.8793.0
    HHA.DLL 4.74.8702.0
    _____
    blaff

  12. #12

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    First of all thanx guys for your help,

    at my Pc here at Home I dont get any Error Messages, just like you said! I just do not understnd this.

    blaff I will be checking the version at work tomorrow, i`ll let you know what version I am working with!

    Thanx again, cu

    Stephan
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

  13. #13

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    Well guys thanks for helping.

    I created a new Help Project, tried that one, and it worked perfectliy allright! Just cant imagine what went wrong with that other file! Well anyways, thanx to all of you!

    Have a nice day,


    Stephan
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

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