Several methods of calling CHM help in VB
An application is perfect, and in many cases, the user will still ask questions. Visual Basic provides support for two different help systems: Traditional Windows Help Systems (WinHelp) and New HTML Help (CHM Help). When we make good help files, we need to write code in the appropriate location of the program. This article will discuss several ways to call the CHM help file in the program. Methods A use of F1 keys: this method is the simplest, just as follows: private sub form_load () app.helpfile = app.path & "/help.chm" 'call and the main program in the same directory Help.chm Help file, press F1 key to call END SUB
Method 2 Using SendKeys method: private subform_load () app.helpfile = app.path & "/help.chm" end sub private subs "{f1}" 'send keystroke to the active window END SUB
Method 3 Use the shell function: private subdhelp_click () shell "hh.exe help.chm", vbnormalfocus' help.chm is the specified help file, can contain the path. End Sub
Method Four Use HtmlHelp function: the first statement following API: Option ExplicitPrivate Declare Function HtmlHelpA Lib "hhctrl.ocx" (ByVal hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long 'hwndCaller designated caller Window, pszfile specifies the file to be called, Ucommand is a command sent to HTMLHELP, DWDATA is the parameter of Ucommand. Then call during the process: private subdhelp_click () DIM I as stringi = app.path & "/help.chm" 'Use variable I record with the Help.chm help file under the same directory HTMLHELPA FORM1.HWND, I, 0, 0nd Sub