Showing Windows Help From A Visual Basic Program
You can display a Windows Help file (.hlp) with the Common Dialog control's ShowHelp method. To use this method, you first set the Common Dialog control's HelpCommand property to one of the following settings, and the HelpFile property to the actual name of the Help file to open. Here are the possible settings for HelpCommand:
" cdlHelpCommand_&H102&; executes a Help macro.
" cdlHelpContents_&H3&; displays the Help contents topic as defined by the Contents option in the [OPTION] section of the HPJ file. This constant doesn't work for Help files created with Microsoft Help Workshop Version 4.0X. Instead, you use the value &HB to get the same effect.
" cdlHelpContext_&H1&; displays Help for a particular context. When using this setting, you must also specify a context using the HelpContext property.
" cdlHelpContextPopup_&H8&; displays in a pop-up window a particular Help topic identified by a context number defined in the [MAP] section of the HPJ file.
" cdlHelpForceFile_&H9&; ensures WinHelp displays the correct Help file. If the correct Help file is currently displayed, no action occurs. If the incorrect Help file is displayed, WinHelp opens the correct file.
" cdlHelpHelpOnHelp_&H4&; displays Help for using the Help application itself.
" cdlHelpIndex_&H3&; displays the index of the specified Help file. An application should use this value only for a Help file with a single index.
" cdlHelpKey_&H101&; displays Help for a particular keyword. When using this setting, you must also specify a keyword using the HelpKey property.
" cdlHelpPartialKey_&H105&; displays the topic found in the keyword list that matches the keyword passed in the dwData parameter if there is one exact match.
" cdlHelpQuit_&H2&; notifies the Help application that the specified Help file is no longer in use.
" cdlHelpSetContents_&H5&; determines which contents topic is displayed when a user presses the F1 key.
" cdlHelpSetIndex_&H5&; sets the context specified by the HelpContext property as the current index for the Help file specified by the HelpFile property.
You can display a Windows Help file (.hlp) with the Common Dialog control's ShowHelp method. To use this method, you first set the Common Dialog control's HelpCommand property to one of the following settings, and the HelpFile property to the actual name of the Help file to open. Here are the possible settings for HelpCommand:
" cdlHelpCommand_&H102&; executes a Help macro.
" cdlHelpContents_&H3&; displays the Help contents topic as defined by the Contents option in the [OPTION] section of the HPJ file. This constant doesn't work for Help files created with Microsoft Help Workshop Version 4.0X. Instead, you use the value &HB to get the same effect.
" cdlHelpContext_&H1&; displays Help for a particular context. When using this setting, you must also specify a context using the HelpContext property.
" cdlHelpContextPopup_&H8&; displays in a pop-up window a particular Help topic identified by a context number defined in the [MAP] section of the HPJ file.
" cdlHelpForceFile_&H9&; ensures WinHelp displays the correct Help file. If the correct Help file is currently displayed, no action occurs. If the incorrect Help file is displayed, WinHelp opens the correct file.
" cdlHelpHelpOnHelp_&H4&; displays Help for using the Help application itself.
" cdlHelpIndex_&H3&; displays the index of the specified Help file. An application should use this value only for a Help file with a single index.
" cdlHelpKey_&H101&; displays Help for a particular keyword. When using this setting, you must also specify a keyword using the HelpKey property.
" cdlHelpPartialKey_&H105&; displays the topic found in the keyword list that matches the keyword passed in the dwData parameter if there is one exact match.
" cdlHelpQuit_&H2&; notifies the Help application that the specified Help file is no longer in use.
" cdlHelpSetContents_&H5&; determines which contents topic is displayed when a user presses the F1 key.
" cdlHelpSetIndex_&H5&; sets the context specified by the HelpContext property as the current index for the Help file specified by the HelpFile property.
This index remains current until the user accesses a different Help file. Use this value only for Help files with more than one index. Often, you want to open a Help file to its contents page, and so you'd set the HelpCommand property to the cdlHelpContents constant. Be careful, however, that constant doesn't work with some Help files (those constructed with the Microsoft Help Workshop Version 4.0X), so check if ShowHelp works properly before releasing your program. The cdlHelpContents constant works with fewer Help files than you might think in fact, it won't open the main Windows Help file itself, windows.hlp, correctly. Instead, you must use a special value, &HB:
Private Sub Command1_Click()
CommonDialog1.HelpCommand = &HB
CommonDialog1.HelpFile = "c:\windows\help\windows.hlp"
CommonDialog1.ShowHelp
End Sub
Our ShowHelp example is a success. The code for this example is located in the helpdialog folder on this book_s accompanying CD-ROM.
Private Sub Command1_Click()
CommonDialog1.HelpCommand = &HB
CommonDialog1.HelpFile = "c:\windows\help\windows.hlp"
CommonDialog1.ShowHelp
End Sub
Our ShowHelp example is a success. The code for this example is located in the helpdialog folder on this book_s accompanying CD-ROM.
0 comments:
Post a Comment
Dear Visitors All The Tricks And Hacks Posted Here Are Only For Knowledge Purpose.Don't Use These for Illegal Operations.