Silverfrost Forums

Welcome to our forums

Accessing .chm files from FTN95

24 Jan 2012 6:17 #9482

I've got a compiled help (.chm) file that I'd like to access various pages from to provide context sensitive help. I think the winAPI function I'd like to call is 'HtmlHelp' (see http://msdn.microsoft.com/en-us/library/ms670172.aspx)

So, I've tried various declaration statements:

C_EXTERNAL HTMLHELP '__HtmlHelp' (VAL, STRING, VAL, VAL) : INTEGER4 C_EXTERNAL HTMLHELP '_HtmlHelp' (VAL, STRING, VAL, VAL) : INTEGER4 C_EXTERNAL HTMLHELP 'HtmlHelp' (VAL, STRING, VAL, VAL) : INTEGER4 C_EXTERNAL HTMLHELP '__htmlhelp' (VAL, STRING, VAL, VAL) : INTEGER4 C_EXTERNAL HTMLHELP '_htmlhelp' (VAL, STRING, VAL, VAL) : INTEGER4 C_EXTERNAL HTMLHELP 'htmlhelp' (VAL, STRING, VAL, VAL) : INTEGER4

But whatever I tried, it comes up as an undefined external at link time.

What have I missed!?

TIA

K

edit: I've also tried (taken from another forum question):

STDCALL HTMLHELP 'HtmlHelpA' (VAL,STRING,VAL,VAL):INTEGER*4 LIBRARY 'c:\windows\system32\hhctrl.ocx'

but it didn't help.

K

OK, sussed it! The OCX file needs to be included in the link script!

K

25 Jan 2012 8:10 #9494

Looks wrong to me. You can run CHM files using HH.EXE. Here's my routine for doing so. It is a callback to the Help menu item:

      INTEGER FUNCTION IHELPSYS()
C     --------------------------
       CHARACTER*(256) PNAME
       INCLUDE <WINDOWS.INS>
C      -----------------------------------------------------------------
      IHELPSYS = 1
      CALL GET_PROGRAM_NAME@ (PNAME)
      CALL UPCASE@ (PNAME)
      N = LEN_TRIM (PNAME)
      IF (PNAME (N-5:N) .EQ. 'XX.EXE') THEN 
      N = N - 6            ! Assumes XX.EXE
      CALL START_PPROCESS@('HH.EXE',PNAME(1:N)//'WSXHelp.chm')
      ELSE
      DO 10 I=1,N
      J = N + 1 - I
      IF (PNAME(J:J) .EQ. '\') GO TO 20
  10  CONTINUE
      RETURN
  20  CALL START_PPROCESS@('HH.EXE',PNAME(1:J)//'XXHelp.chm')
      ENDIF
      END

It is only the CALL START_PPROCESS that you need: I assume that the CHM is in the same folder as the EXE.

Any help?

Eddie

26 Jan 2012 8:44 #9497

Both approaches are viable. The first may give more control over direct access to particular topics etc.

26 Jan 2012 9:00 #9499

True. Using HtmlHelp, I can kick off the compiled help file at a particular topic, on a particular page. But I think the same is true of 'HH':

'HH helpfile.chm::/document.htm#title'

seems to work as well.

There are other options with HtmlHelp, though, for example to start the help file at the index tab. Not sure how to do that with 'HH'.

K

4 Oct 2012 2:50 #10800

one problem i have with using the HtmlHelp method is that printing fails. The call i'm making is:

	STDCALL HTMLHELP  'HtmlHelpA' (VAL, STRING, VAL, VAL) : LOGICAL*4
.
.
.
            CTEMP = 'helpfile.chm::/document.htm#title'
            LRET  =  HTMLHELP (0,CTEMP, 0, 0)

But perhaps the 'zeroes' should be something else?

K

4 Oct 2012 2:57 #10801

Kenny,

Doesn't HH start at the index tab if you don't give it instructions to start elsewhere?

My HH (Win 7 32) has a Home toolbar button to get to the start, the tree can be shown or removed, and there is a print button.

Eddie

4 Oct 2012 3:37 #10803

If HtmlHelp requires a NULL value for an argument then you should pass CORE4(0).

5 Oct 2012 1:01 #10805

I tried passing core4(0) and it didn;t help.

The print button is there, but it just comes up with a popup ('An error occurred with this operation'). The printer selection dialogue briefly flashes first.

I should say that the printing function works OK if I use 'HH' or just double click the CHM file.

K

Please login to reply.