Announcement

Collapse
No announcement yet.

How do you link to a Help file?

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

  • How do you link to a Help file?

    How do you "simply" call (or activate) a Windows Help (HLP) file from within a PB/DLL program? I'm using the following code to capture WHEN the Context Help is Requested:

    CASE %WM_HELP
    LOCAL lphi AS HELPINFO PTR, a$
    lphi = CBLPARAM
    IF @lphi.iCtrlId THEN CONTROL GET TEXT CBHNDL, @lphi.iCtrlId TO a$
    IF @lphi.iCtrlId>1 AND @lphi.iCtrlId<60000 THEN
    MSGBOX "HELP!!! - you asked for help on control ID#" & STR$(@lphi.iCtrlId) & $CRLF & _
    "The control text = """ & a$ & """",, "Context Help"
    END IF
    CONTROL SET FOCUS CBHNDL, @lphi.iCtrlId

    -----------------------------------------------------------

    This portion of the code works just fine, and reports the propper control ID. BUT, I have no clue as to just how to call up or activate the Help file and pass just where in the file I want to be displayed? (I don't care which I can pass: a reference/bookmark number or 'Keywords' to be automatically searched to the Help file).

    BTW: How do you get the BBS to keep the formatting when you paste in source code? (My posts alway look like garbage after I post any code).

    Many Thanks,

    Ray Corry




    [This message has been edited by Ray Corry (edited February 19, 2000).]

  • #2
    Take a look at the API call "WinHelp", plus some related calls,
    "SetWindowContextHelpId" and "GetWindowContextHelpId".

    If you write [code] followed by the actual code and then finish it
    with the same plus a slash, "/code" in brackets, the formatting is
    preserved. Note: empty lines within the code must have a single space
    on them, otherwise they will be removed and the code gets harder to
    read.

    ------------------




    [This message has been edited by Borje Hagsten (edited February 20, 2000).]

    Comment


    • #3
      Thanks Borje,

      I now have the Windows Help Dialog launching and typing into my Application. (Still a little work to do on the Help file, but it works quite well).

      My only remaining problem is that after the WinHelp is called, I don't seem to be able to set the FOCUS back to the control it was on. (Unless I put a MSGBOX after the WinHelp call). I *think* its due to the fact that my application is no longer the Top-Most Window (the Help Dialog is util its closed). Anybody have a solution to this little quirk?

      Thanks,

      Ray


      *** The Code I'm Using looks like this ***
      Code:
           CASE %WM_HELP
                LOCAL lphi AS HELPINFO PTR, a$
       
                lphi   = CBLPARAM
                HlpDlg = CBHNDL
                HlpControl = @lphi.iCtrlId
      
                IF HlpControl THEN CONTROL GET TEXT CBHNDL, HlpControl TO a$
                IF HlpControl>1 AND HlpControl<60000 THEN
                   LOCAL hwnd AS LONG
                   LOCAL lpHelpFile AS ASCIIZ * 12
                   LOCAL dwData AS LONG
      
                   hwnd = ghDlg
                   lpHelpFile = "pabop.hlp"
                   dwData = HlpControl
      
                   WinHelp hwnd, lpHelpFile, %HELP_CONTEXT, dwData
      '             MSGBOX "HELP!!! - you asked for help on control ID#" & STR$(@lphi.iCtrlId) & $CRLF & _
      '             "The control text = """ & a$ & """",, "Context Help"
                END IF
                CONTROL SET FOCUS HlpDlg, HlpControl
      ---------------------------------------------------------

      If I allow the MSGBOX to run the 'CONTROL SET FOCUS' works, but w/o the MSGBOX the form reverts back to 1st field/control on the screen. (Its really annoying).

      Thanks Again,

      Ray



      ------------------

      Comment

      Working...
      X