Announcement

Collapse
No announcement yet.

Bringing up help files

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

  • Bringing up help files

    This is probably so trivial that I'm an idiot for asking for help. But….
    I'm trying to figure out how to bring up the help file for my program. Knowing how the ShellExecute API call works (or so I thought), I know (or so I thought) that when you pass it a file the system knows the extension of, it will "run" it correctly. For example, in PBDLL, if you want you application to open the default browser to a specific URL, the following subroutine works quite well:

    SUB Open_URL(BYVAL URL AS STRING)
    '
    ' If this is called, the system's defaul browser is started
    ' and pointed at the URL.
    '
    DIM URLz AS ASCIIZ*255
    DIM Nullz AS ASCIIZ*255
    URLz=URL
    Nullz=""
    CALL ShellExecute(0&, Nullz, URLz, Nullz, Nullz, 1)
    END SUB

    My understanding is the ShellExecute when passed a file name, checks the system for the application that recognizes it, and runs that application with the passed file handed off to it. So….. I'd had thought in PB DLL that I could use the following to get my application to run the HELP file for the user:

    SUB OpenHelp(BYVAL HelpFileName AS STRING)
    '
    ' If this is called, the passed help file in the pplication default
    ' directory is executed..
    '
    LOCAL HelpFileNamez AS ASCIIZ*255
    LOCAL Nullz AS ASCIIZ*255
    HelpFileNamez=HelpFileName
    Nullz=""
    CALL ShellExecute(0&, Nullz, HelpFileNamez, Nullz, Nullz, 1)
    END SUB

    Bottom line is my attempt to bring up the help file does not work, but also generates no errors. (Sort of like a doctor burying his mistakes.) But I'd rather it work. J

    By the way, I do recognize that if my help files were converted to html, I could avoid this issue.

    ------------------
    Michael Burns
    http:\\www.revise.com
    Michael Burns

  • #2
    I think you want the WinHelp API, not ShellExecute.

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    "Not my circus, not my monkeys."

    Comment


    • #3
      The following is an extract from the next release of my main prog.
      Hopefully, it can be of some help. %IDM_HELP is the id for the main
      Help in the menu, where the index page shall be shown. %IDM_HLPSEARCH
      is the id for the "Search for Help on" menu item and %IDM_PRESENT is
      the id for a "Presentation" menu item, one that points to a certain
      help page (here, topic 19):

      Code:
      'in the declarations:
      GLOBAL AppHelpFile AS ASCIIZ * %MAX_PATH, appPath AS STRING
       
      'in WINMAIN
        LOCAL pthString AS ASCIIZ * %MAX_PATH
       
        GetModuleFileName GetModuleHandle(""), pthString, %MAX_PATH
        appPath = LEFT$(pthString, INSTR(-1, pthString, "\"))
        AppHelpFile  = appPath & "myprog.hlp" 'whatever it's called
       
      'in WndProc, where menus and buttons are trapped:
        CASE %WM_COMMAND
          SELECT CASE LOWRD(wParam)
            CASE %IDM_HELP      : lRes& = WinHelp(hWnd, AppHelpFile, %HELP_INDEX, 0&)
            CASE %IDM_HLPSEARCH : lRes& = WinHelp(hWnd, AppHelpFile, %HELP_PARTIALKEY, 0&)
            CASE %IDM_PRESENT   : lRes& = WinHelp(hWnd, AppHelpFile, %HELP_CONTEXT, 19&)
      In addition to this, you can also assign a certain help topic numnber
      (help page) to a dialog, or any control, with the following in the
      dialog's WINMAIN (or PBMAIN):
      Code:
           CALL SetWindowContextHelpId(hWnd, topicNum)
      This makes it possible for the user to simply press F1 for context
      sensitive help about the dialog or control in focus..


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


      [This message has been edited by Borje Hagsten (edited September 07, 2000).]

      Comment


      • #4
        Forgot to mention - one can also start winhelp via SHELL and make
        it open any help file with:
        Code:
          SHELL "winhelp " & HelpFileName
        ------------------

        Comment

        Working...
        X