|
WinDev 7.5 -> WinDev 16 - open Help Topic with or without pointing to an anchor Overview: WinDev offers the WHelp(...) command. The WHelp command calls a Help Topic of .chm (compiled html help) file either by Topic ID, which is a numeric or by ‘Keyword’, which is a text item and not unique within the help file. However, using WHelp(...) there’s no way to point to a so-called ‘anchor’ within a Help Topic. Anchors (sometimes called ‘bookmarks’) allow better structuring of Help Topics and lead to specific items within a Help page. A - calling a Help Topic / Help Topic+anchor using HH.exe and DDEStart(..) or ExeRun(..)The simple way is to run HH.exe followed by a parameter Aa) in order to show Help Topic 1234 (without an anchor!) instead of using WHelp(“MyHelpFile.chm”,1234) you can use the command DDEStart(“HH.exe -mapid 1234 MyHelpFile.chm”, DDEActice, True) Ab) Alternatively, you can use the commandsDDEStart(“HH mk:@MSITStore:MyHelpFile.chm::/Topic1234.html”, DDEActive, True) orDDEStart(“HH ms-its:MyHelpFile.chm::/Topic1234.html”, DDEActive, True)ExeRun(“HH.exe ms-its:MyHelpFile.chm::/Topic1234.html”, ExeActive, ExeDontWait) Ac) In order to show a help topic and move the help page down to an anchor:DDEStart(“HH ms-its:MyHelpFile.chm::/Topic1234.html#anchor”, DDEActive, True) Tipps & Tricks- make sure that HH.exe which is part of the Microsoft Help SDK, has been copied to the exe directory of your program and make sure it’s installed on the customer’s computer together with your program there. Though HH.exe can be found in the \Windows directory, it is always a good idea to have a working HH.exe in the application’s directory. - You can test the commands from the console and input. Example:C:\My Projects\MyBestProject>HH ms-its:MyBestProject.chm::/Topic1234#anchor3 - To find out the correct names of your topic and anchor, just open the .chm file by double-clicking it, show the desired help page, right-click it (or the anchor, if you need anchor-info), choose ‘properties’ from the context menue and note the info there! Be aware of the fact that the shown Help window crashes each time after showing the properties. I don’t know why. - beware: anchors containing a dot do not work with HH.exe (therefore don’t useTopic123.html#Topic123.AnchorName but rather use Topic123.html#AnchorName ) Note: most help editors have a parameter where you can define the anchor’s style! - you’ll find a good intro to help files and opening topics here:http://www.help-info.de/en/Help_Info_HTMLHelp/hh_command.htm B - calling a Help Topic / Help Topic+anchor using the Windows API HtmlHelpAOf course, there’s a way to show a help topic without installing or using HH.exe ! Make a new global procedure and name it to your likings PROCEDURE CallDaHelp(sHelpFile is string, sHelpTopic is string) LOCAL HH_DISPLAY_TOPIC is int = 0x0 HH_SET_WIN_TYPE is int = 0x4 HH_GET_WIN_TYPE is int = 0x5 HH_GET_WIN_HANDLE is int = 0x6 HH_DISPLAY_TEXT_POPUP is int = 0xE //Display string resource ID or text in a pop-up window. HH_HELP_CONTEXT is int = 0xF //Display mapped numeric value in dwData. HH_TP_HELP_CONTEXTMENU is int = 0x10 //Text pop-up help, similar to WinHelp's HELP_CONTEXTMENU. HH_TP_HELP_WM_HELP is int = 0x11 //text pop-up help, similar to WinHelp's HELP_WM_HELP. HH_CLOSE_ALL is int = 0x12 sHelpFile = CompleteDir(fExeDir())+sHelpFile CallDLL32("hhctrl.ocx","HtmlHelpA", 0, sHelpFile, HH_DISPLAY_TOPIC, sHelpTopic) RETURN Showing a Help Topic from your program is easy. Example:CallDaHelp(“MyHelpFile.chm”,”Topic1234.html”) Showing an anchor within a Help Topic is easy too:CallDaHelp(“MyHelpFile.chm”,”Topic1234.html#MyAnchor”) The Windows API function HtmlHelpA(..) offers much more than just showing a Help window and pointing to a Topic or to an anchor! Read more about HtmlHelpA:http://msdn.microsoft.com/en-us/library/aa164218(v=office.10).aspx C - Showing a Help Topic using the current BrowserTheoretically, the most easy way to show a Help Topic is to use the Browser of the current computer. The WinDev function ShellExecute(..) offers a conveniant way to ‘simulate’ a double-click on a file with a known extension in the Windows Explorer. Practically, it is the only Help you can offer to your customers when deploying Linux or Java applications! Example:
ShellExecute(CompleteDir(fExeDir())+"HTML_Help\Topic20.html") or
ShellExecute("http://www.windev.at/html/wd16chmhelp.html")
The first advantage: this type of Help is usable in Java and Linux programs too!Since Linux / Java programs do not offer a Help-API for .chm-files as Windows does, you have to prepare real HTML-pages for Help. Most Help Authoring Tools offer to make a ‘Web Help System’ from your help pages. For local help, the help pages have to be put into a separate directory. When deploying the application, you’d have to take care of that to. A loophole could be to offer the Help pages online. Online help offers the advantage of a central resource that can be easily updated. Disadvantage 1: most times, this type of help pages contains ‘scripts’ - at least Windows will ask at runtime whether it should allow for locally executing these scripts. You can adjust the security level or exclude your application in ‘Internet options’ of the browser - this will not work if the application is deployed by download. Of course, you could try to make a ‘pure html’ help system .. or provide help by web. Disadvantage 2: since the file extension is the ‘signal’ to start the associated application (= the browser), you will not be able to show an anchor within a help page. D - Showing a Help Topic or point to an anchor using an HTML control.Since v9 WinDev offers an HTML-control for Windows and Windows mobile applications. In v16, it is available for Android and Windows Phone 7 too. Sorry, no Linux and no Java. An html web help system can be shown in the HTML-control. E - Showing a Help Topic in an RTF-text edit controlMost Help Authoring Tools can export your help as an RTF document or you could write your Help system from scratch in WordPad or any other RTF-text editor. Downside of using an RTF-edit-control is that WinDev’s Edit controls cannot show images embedded in the text. Text-only! |