Announcement

Collapse
No announcement yet.

HTML Help Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTML Help Problem

    Question, I have both a parent dialog and a DLL called from the parent. If I open a CHM file using the following code, and then open a different help file from the DLL (different file but same call encapsulated in the DLL), the application hangs. Can anyone suggest why this is or a remediation?

    thanks

    regards

    Dean

    Code:
       '  Derived from:     http://www.powerbasic.com/support/forums/Forum4/HTML/002083.html
       '  see also:         http://www.powerbasic.com/support/forums/Forum7/HTML/000314.html
    
       'Include HtmlHelp.inc file to setup HtmlHelp equates like %HH_HELP_CONTEXT
       #INCLUDE "htmlhelp.inc"       '  provided as part of PB
    
       DECLARE FUNCTION HtmlHelp LIB "hhctrl.ocx" ALIAS "HtmlHelpA" ( BYVAL hwndCaller  AS DWORD    , _
                                                                            pszFile     AS ASCIIZ   , _
                                                                      BYVAL uCommand    AS LONG     , _
                                                                      BYVAL dwData      AS LONG        ) AS LONG
    
       DECLARE FUNCTION HtmlHelp_ByKeyword(hDlg                   AS LONG     , _
                                           S_FileName_HtmlHelp    AS STRING   , _
                                           S_HTMLHelp_Keyword     AS STRING      ) AS LONG
    
    FUNCTION HtmlHelp_ByKeyword(hDlg                   AS LONG     , _
                                S_FileName_HtmlHelp    AS STRING   , _
                                S_HTMLHelp_Keyword     AS STRING      ) AS LONG
    
       '  Generate STRPTR from keyword
       '  Derived from  http://www.powerbasic.com/support/forums/Forum7/HTML/000314.html
       '  General usage is as follows:
       '  HtmlHelp_ByKeyword CBHNDL, S_FilePath_FTEAgent + "FTEAgent.chm" , "Activating the Agent"
    
    
       DIM A_FileName_HtmlHelp    AS ASCIIZ*255
       DIM A_HTMLHelp_Keyword     AS ASCIIZ*255
       DIM hlk                    AS HH_AKLINK
    
       A_HTMLHelp_Keyword   = S_HTMLHelp_Keyword
       hlk.cbStruct         = SIZEOF(hlk)
       hlk.fReserved        = %FALSE
       hlk.pszKeywords      = VARPTR(A_HTMLHelp_Keyword)
       hlk.pszUrl           = %NULL
       hlk.pszMsgText       = %NULL
       hlk.pszMsgTitle      = %NULL
       hlk.pszWindow        = %NULL
       hlk.fIndexOnFail     = %TRUE
    
       A_FileName_HtmlHelp  = S_FileName_HtmlHelp
    
       HtmlHelp hDlg, A_FileName_HtmlHelp, %HH_KEYWORD_LOOKUP   , BYREF hlk
    
    END FUNCTION
    
    
    #IF 00   '  Usage example
       HtmlHelp CBHNDL, A_FileName_Help_CHM, 00              , 00  '  to display the default listing
       HtmlHelp CBHNDL, A_FileName_Help_CHM, %HH_HELP_CONTEXT, 10  '  to display unit number 10
    
    
       '  keywork pointer type, just for reference, resides in the htmlhelp.inc file
       TYPE HH_AKLINK
          cbStruct     AS LONG
          fReserved    AS LONG
          pszKeywords  AS ASCIIZ PTR
          pszUrl       AS ASCIIZ PTR
          pszMsgText   AS ASCIIZ PTR
          pszMsgTitle  AS ASCIIZ PTR
          pszWindow    AS ASCIIZ PTR
          fIndexOnFail AS LONG
       END TYPE
    
             '  Call by strptr keyword
             DIM A_HTMLHelp_Keyword     AS ASCIIZ*255
             DIM hlk                    AS HH_AKLINK
             A_HTMLHelp_Keyword = "About FTE"
             hlk.cbStruct      = SIZEOF(hlk)
             hlk.fReserved     = %FALSE
             hlk.pszKeywords   = VARPTR(A_HTMLHelp_Keyword)
             hlk.pszUrl        = %NULL
             hlk.pszMsgText    = %NULL
             hlk.pszMsgTitle   = %NULL
             hlk.pszWindow     = %NULL
             hlk.fIndexOnFail  = %TRUE
             A_FileName_FTEAgentHelp    = S_FilePath_FTEAgent + "Help FTE Agent.chm"
             HtmlHelp CBHNDL, A_FileName_FTEAgentHelp, %HH_KEYWORD_LOOKUP, BYREF hlk
    
    
       '  Also taken from the htmlhelp.inc file:
       ' Commands to pass to HtmlHelp()
    
    %HH_DISPLAY_TOPIC        = &H0000
    %HH_HELP_FINDER          = &H0000   ' WinHelp equivalent
    %HH_DISPLAY_TOC          = &H0001
    %HH_DISPLAY_INDEX        = &H0002
    %HH_DISPLAY_SEARCH       = &H0003
    %HH_SET_WIN_TYPE         = &H0004
    %HH_GET_WIN_TYPE         = &H0005
    %HH_GET_WIN_HANDLE       = &H0006
    %HH_ENUM_INFO_TYPE       = &H0007   ' Get Info type name, call repeatedly to enumerate, -1 at end
    %HH_SET_INFO_TYPE        = &H0008   ' Add Info type to filter.
    %HH_SYNC                 = &H0009
    %HH_RESERVED1            = &H000A
    %HH_RESERVED2            = &H000B
    %HH_RESERVED3            = &H000C
    %HH_KEYWORD_LOOKUP       = &H000D
    %HH_DISPLAY_TEXT_POPUP   = &H000E   ' display string resource id or text in a popup window
    %HH_HELP_CONTEXT         = &H000F   ' display mapped numeric value in dwData
    %HH_TP_HELP_CONTEXTMENU  = &H0010   ' text popup help, same as WinHelp %HELP_CONTEXTMENU
    %HH_TP_HELP_WM_HELP      = &H0011   ' text popup help, same as WinHelp %HELP_WM_HELP
    %HH_CLOSE_ALL            = &H0012   ' close all windows opened directly or indirectly by the caller
    %HH_ALINK_LOOKUP         = &H0013   ' ALink version of %HH_KEYWORD_LOOKUP
    %HH_GET_LAST_ERROR       = &H0014   ' not currently implemented ' See HHERROR.h [*** PB note: the Windows SDK has no such file]
    %HH_ENUM_CATEGORY        = &H0015   ' Get category name, call repeatedly to enumerate, -1 at end
    %HH_ENUM_CATEGORY_IT     = &H0016   ' Get category info type members, call repeatedly to enumerate, -1 at end
    %HH_RESET_IT_FILTER      = &H0017   ' Clear the info type filter of all info types.
    %HH_SET_INCLUSIVE_FILTER = &H0018   ' set inclusive filtering method for untyped topics to be included in display
    %HH_SET_EXCLUSIVE_FILTER = &H0019   ' set exclusive filtering method for untyped topics to be excluded from display
    %HH_INITIALIZE           = &H001C   ' Initializes the help system.
    %HH_UNINITIALIZE         = &H001D   ' Uninitializes the help system.
    %HH_SET_QUERYSERVICE     = &H001E   ' Set the Host IQueryService interface
    %HH_PRETRANSLATEMESSAGE  = &H00fd   ' Pumps messages. (%NULL, %NULL, MSG PTR).
    %HH_SET_GLOBAL_PROPERTY  = &H00fc   ' Set a global property. (%NULL, %NULL, HH_GPROP)
    
    
    #ENDIF

  • #2
    >HtmlHelp hDlg, A_FileName_HtmlHelp, %HH_KEYWORD_LOOKUP , BYREF hlk

    HH_KEYWORD_LOOKUP
    ....

    You must first call the HH_DISPLAY_TOPIC command before calling this command to ensure that the help window is created.
    Required call not shown. Doesn't mean you don't do that, but I don't see it here.

    PS: That one or more functions happen to be loaded from a DLL is immaterial.
    Last edited by Michael Mattias; 15 Jun 2009, 08:07 AM. Reason: Add DLL note
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      thanks, I will test later and followup this posting.

      Comment


      • #4
        I tried the HH_DISPLAY_TOPIC command first, basically leading the call for TOC or a help topic. It still hangs. Any ideas?

        Comment


        • #5
          "hang" is an insufficient description of the problem. It is only marginally better than the allegedly-failing code you have posted.

          Does the call to HTML help return? If so, what is the error code and what does it mean?

          No... wait a minute... FIRST... run the application MINUS any calls to HTMLHelp. If that does not "hang" then you know the problem is with the way you've implemented HTMLHelp. Right know for all we know you are in a 'DO UNTIL 2+2 <> 4 ' loop.

          MCM
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment

          Working...
          X