Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
dannycat
Total Points:
2,315
Status Points:
0
Brown Belt
June 27, 2009 6:19 AM PDT
Integrating Help *.chm files in FORTRAN applications
I'm about to embark in creating a help system for my application. Most current help compilers create HTML Help files (*.chm) whereas previously WinHelp (*.hlp) files were the norm. Apparently the support for Winhelp (*.hlp) has been withdrawn by Microsoft with the advent of Vista. Although you can still download the WinHelp I prefer to use the current format. My question is how do you call up the HTML format help files from within a windows application.  The Generic sample provided still utilises the WinHelp API function which does not recognise HTML files.
Paul Curtis
Total Points:
2,310
Status Points:
1,810
Brown Belt
June 27, 2009 6:40 AM PDT
Rate
 
#1
Quoting - dannycat
I'm about to embark in creating a help system for my application. Most current help compilers create HTML Help files (*.chm) whereas previously WinHelp (*.hlp) files were the norm. Apparently the support for Winhelp (*.hlp) has been withdrawn by Microsoft with the advent of Vista. Although you can still download the WinHelp I prefer to use the current format. My question is how do you call up the HTML format help files from within a windows application.  The Generic sample provided still utilises the WinHelp API function which does not recognise HTML files.

Add the attached .lib file to your project.  Use this interface:

INTERFACE 
	FUNCTION HtmlHelp (hWndMain, lpszHelp, uCommand, dwData)
		USE ifwinTY
		integer(BOOL) :: HtmlHelp ! BOOL
		!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'HtmlHelpA' :: HtmlHelp
		integer(HANDLE) hWndMain ! HWND hWndMain
		!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpszHelp
		character*(*) lpszHelp ! LPCSTR lpszHelp
		integer(UINT) uCommand ! UINT uCommand
		integer(ULONG_PTR) dwData ! ULONG_PTR dwData
	END FUNCTION
END INTERFACE

and then your procs will need to process WM_HELP in the message loop handler:

CASE (WM_HELP)
	rval = HtmlHelp (ghwndmain, helppathname, HH_DISPLAY_TOPIC, NULL)



 Attachments 
dannycat
Total Points:
2,315
Status Points:
0
Brown Belt
June 27, 2009 7:59 AM PDT
Rate
 
#2 Reply to #1
Quoting - Paul Curtis

Add the attached .lib file to your project.  Use this interface:

INTERFACE 
	FUNCTION HtmlHelp (hWndMain, lpszHelp, uCommand, dwData)
		USE ifwinTY
		integer(BOOL) :: HtmlHelp ! BOOL
		!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'HtmlHelpA' :: HtmlHelp
		integer(HANDLE) hWndMain ! HWND hWndMain
		!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpszHelp
		character*(*) lpszHelp ! LPCSTR lpszHelp
		integer(UINT) uCommand ! UINT uCommand
		integer(ULONG_PTR) dwData ! ULONG_PTR dwData
	END FUNCTION
END INTERFACE

and then your procs will need to process WM_HELP in the message loop handler:

CASE (WM_HELP)
	rval = HtmlHelp (ghwndmain, helppathname, HH_DISPLAY_TOPIC, NULL)


Thanks Paul,

Where are HH_DISPLAY_TOPIC and other such constants defined?


Paul Curtis
Total Points:
2,310
Status Points:
1,810
Brown Belt
June 27, 2009 10:43 AM PDT
Rate
 
#3 Reply to #2
Quoting - dannycat

Thanks Paul,

Where are HH_DISPLAY_TOPIC and other such constants defined?

! HTML help command flags
INTEGER, PARAMETER	:: HH_DISPLAY_TOPIC 	 = #0000
INTEGER, PARAMETER	:: HH_DISPLAY_TOC	         = #0001
INTEGER, PARAMETER	:: HH_DISPLAY_INDEX	         = #0002
INTEGER, PARAMETER	:: HH_DISPLAY_SEARCH	 = #0003
INTEGER, PARAMETER	:: HH_KEYWORD_LOOKUP	 = #000D
INTEGER, PARAMETER	:: HH_DISPLAY_TEXT_POPUP = #000E
INTEGER, PARAMETER	:: HH_CLOSE_ALL                 = #0012



dannycat
Total Points:
2,315
Status Points:
0
Brown Belt
June 27, 2009 1:08 PM PDT
Rate
 
#4 Reply to #3
Quoting - Paul Curtis

! HTML help command flags
INTEGER, PARAMETER	:: HH_DISPLAY_TOPIC 	 = #0000
INTEGER, PARAMETER	:: HH_DISPLAY_TOC	         = #0001
INTEGER, PARAMETER	:: HH_DISPLAY_INDEX	         = #0002
INTEGER, PARAMETER	:: HH_DISPLAY_SEARCH	 = #0003
INTEGER, PARAMETER	:: HH_KEYWORD_LOOKUP	 = #000D
INTEGER, PARAMETER	:: HH_DISPLAY_TEXT_POPUP = #000E
INTEGER, PARAMETER	:: HH_CLOSE_ALL                 = #0012


Thanks again! Everything works fine now.

dannycat
Total Points:
2,315
Status Points:
0
Brown Belt
June 27, 2009 1:43 PM PDT
Rate
 
#5 Reply to #4
Quoting - dannycat

Thanks again! Everything works fine now.

Uh Oh. I spoke too soon. I have got the 32-bit version to work but the 64-bit configuration will not link. "Unresolved external symbol HtmlHelpA". Does the interface need some tweaking for 64-bit applications?

mavlik
Total Points:
440
Status Points:
390
Green Belt
June 27, 2009 4:32 PM PDT
Rate
 
#6 Reply to #5
To dannycat

function HtmlHelpA (_HtmlHelpA@16) is realized in file 'hhctrl.ocx'. Try to
search similar file.
I don't know why in Fortran the names of dlls is hidden from user. 
In Delphi for example you can make so:
function HtmlHelp(
                  HwndCaller: hwnd;
                  pszFile: string;
                  uCommand: integer;
                  dwData: integer): hwnd; stdcall;  external 'hhctrl.ocx' 

name 'HtmlHelpA';




Paul Curtis
Total Points:
2,310
Status Points:
1,810
Brown Belt
June 27, 2009 4:49 PM PDT
Rate
 
#7 Reply to #5

I don't work in 64bit, but I suspect that htmlhelp.lib may only contain 32-bit versions of the API functions, so that when your code has flexible defines such as INTEGER(HANDLE) which automatically track 32/64 bits, your calling code's Interface will then differ from the actual library routine.  You will probably have to locate a 64-bit version of the library (which I am unable to supply).


m.furqan.latif
Total Points:
25
Registered User
June 28, 2009 2:25 AM PDT
Rate
 
#8
function HtmlHelpA (_HtmlHelpA@16) is realized in file 'hhctrl.ocx'. Try to
search similar file.
I don't know why in Fortran the names of dlls is hidden from user.


--------
Eye Glasses


dannycat
Total Points:
2,315
Status Points:
0
Brown Belt
June 28, 2009 5:37 AM PDT
Rate
 
#9 Reply to #7
Thanks everyone, I've found the library I need in the SDK area.

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64






Intel Software Network Forums Statistics

8283 users have contributed to 31229 threads and 99098 posts to date.
In the past 24 hours, we have 25 new thread(s) 85 new posts(s), and 120 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is It certainly appears that al

Please welcome our newest member shoguntom