Re: How do I launch a .hlp file from a Euphoria windows program?
- Posted by Pete Stoner <stoner.pete at gmail.com> Apr 02, 2007
- 827 views
Andrew Katz wrote: > > I was wondering how to start a Microsoft Windows hlp file from a Euphoria > windows > program? > > I noticed that people are using HTML for help, even in Euphoria. So, should > I be writing help in that form? > To launch a compilied HTML (chm) help file, I use this include (hh.ew - not sure who wrote it or where I found it so apologies to the author..)
-- HtmlHelp function for opening context sensitive help include w32support.e constant HH = open_dll( "hhctrl.ocx" ), HtmlHelp = define_c_func( HH, "HtmlHelpA", {C_POINTER, C_POINTER, C_UINT, C_LONG}, C_POINTER) -- Commands to pass to HtmlHelp() global constant HH_DISPLAY_TOPIC = #0000, -- i.e. format for 'file' = "myHelp.chm::\\topic1.htm" ('data' = NULL) HH_HELP_FINDER = #0000, -- WinHelp equivalent HH_DISPLAY_TOC = #0001, HH_DISPLAY_INDEX = #0002, HH_DISPLAY_SEARCH = #0003, HH_SET_WIN_TYPE = #0004, HH_GET_WIN_TYPE = #0005, HH_GET_WIN_HANDLE = #0006, HH_ENUM_INFO_TYPE = #0007, -- Get Info type name, call repeatedly to enumerate, -1 at end HH_SET_INFO_TYPE = #0008, -- Add Info type to filter. HH_SYNC = #0009, HH_RESERVED1 = #000A, HH_RESERVED2 = #000B, HH_RESERVED3 = #000C, HH_KEYWORD_LOOKUP = #000D, HH_DISPLAY_TEXT_POPUP = #000E, -- display string resource id or text in a popup window HH_HELP_CONTEXT = #000F, -- display mapped numeric value in dwData HH_TP_HELP_CONTEXTMENU = #0010, -- text popup help, same as WinHelp HELP_CONTEXTMENU HH_TP_HELP_WM_HELP = #0011, -- text popup help, same as WinHelp HELP_WM_HELP HH_CLOSE_ALL = #0012, -- close all windows opened directly or indirectly by the caller HH_ALINK_LOOKUP = #0013, -- ALink version of HH_KEYWORD_LOOKUP HH_GET_LAST_ERROR = #0014, -- not currently implemented -- See HHERROR.h HH_ENUM_CATEGORY = #0015, -- Get category name, call repeatedly to enumerate, -1 at end HH_ENUM_CATEGORY_IT = #0016, -- Get category info type members, call repeatedly to enumerate, -1 at end HH_RESET_IT_FILTER = #0017, -- Clear the info type filter of all info types. HH_SET_INCLUSIVE_FILTER = #0018, -- set inclusive filtering method for untyped topics to be included in display HH_SET_EXCLUSIVE_FILTER = #0019, -- set exclusive filtering method for untyped topics to be excluded from display HH_INITIALIZE = #001C, -- Initializes the help system. HH_UNINITIALIZE = #001D, -- Uninitializes the help system. HH_PRETRANSLATEMESSAGE = #00FD, -- Pumps messages. (NULL, NULL, MSG*). HH_SET_GLOBAL_PROPERTY = #00FC -- Set a global property. (NULL, NULL, HH_GPROP) -- structure HH_AKLINK constant cbStruct = w32allot( Long ), -- sizeof this structure fReserved = w32allot( Long ), -- must be FALSE (really!) pszKeywords = w32allot( Lpsz ), -- semi-colon separated keywords pszURL = w32allot( Lpsz ), -- URL to jump to if no keywords found (may be NULL) pszMsgText = w32allot( Lpsz ), -- Message text to display in MessageBox if pszUrl is NULL and no keyword match pszMsgTitle = w32allot( Lpsz ), -- Message text to display in MessageBox if pszUrl is NULL and no keyword match pszWindow = w32allot( Lpsz ), -- Window to display URL in fIndexOnFail = w32allot( Long ), -- Displays index if keyword lookup fails. SIZEOF_HH_AKLINK = w32allotted_size() ------------------------------ global function htmlHelp( atom hwndCaller, object file, integer command, object data ) atom pszFile, ret, aklink if sequence(file) then pszFile = allocate_string(file) else pszFile = file end if if command = HH_ALINK_LOOKUP or command = HH_KEYWORD_LOOKUP then aklink = w32acquire_mem(0,SIZEOF_HH_AKLINK) w32store(aklink,cbStruct,SIZEOF_HH_AKLINK) w32store(aklink,pszKeywords,data) w32store(aklink,fIndexOnFail,1) ret = c_func(HtmlHelp,{hwndCaller,pszFile,command,aklink}) w32release_mem(aklink) else ret = c_func(HtmlHelp,{hwndCaller,pszFile,command,data}) end if if sequence(file) then free( pszFile ) end if return ret end function
Then call it with..
-- returns 0 if failure helpRes = htmlHelp( getHandle(OwningWindowName), full_path_to_.chm file::\\MainScreen.htm", HH_DISPLAY_TOC, NULL)
with the "::MainScreen.htm" it will open the chm file at that page, so you can easily have context sensitive help by opening at the appropriate page.. Regards PeteS