Add HtmlHelp to Games

Blitz3D Forums/Blitz3D Userlibs/Add HtmlHelp to Games

.decls file code:


;-------------------------------------------------------------------------------
; 
; Author      : GameKing
; Date        : 01-29-2005 Time: 13:52:19 EST
; Title       : hhctrl.ocx decls
; Description : Access HtmlHelp files .chm
; Userlibs    : hhctrl.decls  "SaveAs"
;
;-------------------------------------------------------------------------------

.lib "hhctrl.ocx"

; HtmlHelp API.

api_HtmlHelp% (hwndCaller%, sFile$, uCommand%, dwData%) : "HtmlHelpA"

;-------------------------------------------------------------------------------
; End of hhctrl.decls
;-------------------------------------------------------------------------------
;
                   



Example app:


;
;-------------------------------------------------------------------------------
;
; FileName    : ChmHelp.bb
;
; Description : Access HtmlHelp Files...
;
;-------------------------------------------------------------------------------


; Constants for HtmlHelp
;-------------------------------------------------------------------------------

Const HH_DISPLAY_TOPIC        = 0
Const HH_HELP_FINDER          = 0   ; WinHelp equivalent
Const HH_DISPLAY_TOC          = 1
Const HH_DISPLAY_INDEX        = 2
Const HH_DISPLAY_SEARCH       = 3
Const HH_SET_WIN_TYPE         = 4
Const HH_GET_WIN_TYPE         = 5
Const HH_GET_WIN_HANDLE       = 6
Const HH_ENUM_INFO_TYPE       = 7   ; Get Info Type name, call repeatedly To enumerate, -1 at End
Const HH_SET_INFO_TYPE        = 8   ; Add Info Type To filter.
Const HH_KEYWORD_LOOKUP       = 13
Const HH_DISPLAY_TEXT_POPUP   = 14  ; display String resource id Or Text in a popup window
Const HH_HELP_CONTEXT         = 15  ; display mapped numeric value in dwData
Const HH_TP_HELP_CONTEXTMENU  = 16  ; Text popup help, same as WinHelp HELP_CONTEXTMENU
Const HH_TP_HELP_WM_HELP      = 17  ; Text popup help, same as WinHelp HELP_WM_HELP
Const HH_CLOSE_ALL            = 18  ; close all windows opened directly Or indirectly by the caller
Const HH_ALINK_LOOKUP         = 19  ; ALink version of HH_KEYWORD_LOOKUP
Const HH_GET_LAST_ERROR       = 20  ; Not currently implemented ' See HHERROR.h [Note: the Windows SDK has no such file]
Const HH_ENUM_CATEGORY        = 21  ; Get category name, call repeatedly To enumerate, -1 at End
Const HH_ENUM_CATEGORY_IT     = 22  ; Get category info Type members, call repeatedly To enumerate, -1 at End
Const HH_RESET_IT_FILTER      = 23  ; Clear the info Type filter of all info types.
Const HH_SET_INCLUSIVE_FILTER = 24  ; set inclusive filtering method For untyped topics To be included in display
Const HH_SET_EXCLUSIVE_FILTER = 25  ; set exclusive filtering method For untyped topics To be excluded from display
Const HH_INITIALIZE           = 28  ; Initializes the help system.
Const HH_UNINITIALIZE         = 29  ; Uninitializes the help system.


; Global Variables.
;-------------------------------------------------------------------------------

; Change "Test.chm" to the name of your HtmlHelp File...
Global gsHelpFile$ = CurrentDir$() + "\Test.chm"  ; The Html Help File Path & Name.
Global giContextID%                               ; Holds The Html Help Context ID. 


; Functions.
;-------------------------------------------------------------------------------


;-------------------------------------------------------------------------------
; Function    : DisplayHelpTOC% ()
; Description : Displays HtmlHelp TOC.
; Parameters  : hWnd%  - Window handle or 0.
;               sFile$ - SEE: Global above gsHelpFile$
; Returns     : NONE
;-------------------------------------------------------------------------------

Function DisplayHelpTOC% (hWnd%, sFile$)

	api_HtmlHelp (hWnd%, sFile$, HH_DISPLAY_TOC, 0)

End Function

; Main.

Graphics 640,480       ; goes into graphics mode & sets the resolution

SetBuffer BackBuffer() ; draw to the back buffer

While Not KeyDown(1)   ; keep looping until ESC pressed


	; If F1 Key Down - Display .chm HtmlHelp File.
	If KeyDown(59) Then 
	   DisplayHelpTOC% (0, gsHelpFile$)
	End If
	

	Flip ; swap front and back buffers
	
Wend ; continue until progrgram ends


;-------------------------------------------------------------------------------
; End Of ChmHelp.bb
;-------------------------------------------------------------------------------
;




Enjoy
GameKing

[ codebox ]

[/ codebox ]

remove spaces :)

and coolies :D

Thank you very much Cygnus.

I get a black screen.
Win XP Pro

Hi Peter,

Did you change the .chm help file name to one of your own help files?

I am running Windows XP Pro SP2.

Also the help file needs to be the same directory, and the .decls file in your userlibs directory.


Enjoy

No I did not, sorry.
It works well when I do that.
Thanks.

Your very welcome Peter.