VERSION 2.00
Begin Form frmSample 
   BackColor       =   &H00808080&
   BorderStyle     =   3  'Fixed Double
   Caption         =   "Sample Help"
   ClientHeight    =   3795
   ClientLeft      =   5625
   ClientTop       =   4320
   ClientWidth     =   5130
   FontBold        =   0   'False
   FontItalic      =   0   'False
   FontName        =   "MS Sans Serif"
   FontSize        =   8.25
   FontStrikethru  =   0   'False
   FontUnderline   =   0   'False
   Height          =   4485
   Left            =   5565
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3795
   ScaleWidth      =   5130
   Top             =   3690
   Width           =   5250
   Begin SSCommand cmdClose 
      BevelWidth      =   3
      Caption         =   "Copy"
      Font3D          =   1  'Raised w/light shading
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      ForeColor       =   &H00000040&
      Height          =   375
      Index           =   2
      Left            =   3100
      TabIndex        =   31
      Top             =   2220
      Width           =   1885
   End
   Begin SSPanel cmdReadMe 
      BevelInner      =   1  'Inset
      BevelWidth      =   3
      Caption         =   "Panel3D1"
      Height          =   3795
      Left            =   0
      Outline         =   -1  'True
      TabIndex        =   0
      Top             =   0
      Width           =   5145
      Begin SSCommand cmdClose 
         BevelWidth      =   3
         Caption         =   "Print"
         Font3D          =   1  'Raised w/light shading
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "Arial"
         FontSize        =   8.25
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00000040&
         Height          =   375
         Index           =   3
         Left            =   3100
         TabIndex        =   32
         Top             =   2580
         Width           =   1885
      End
      Begin SSCommand cmdClose 
         BevelWidth      =   3
         Caption         =   "Close Glossary"
         Font3D          =   1  'Raised w/light shading
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "Arial"
         FontSize        =   8.25
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00000040&
         Height          =   375
         Index           =   1
         Left            =   1245
         TabIndex        =   30
         Top             =   2580
         Width           =   1875
      End
      Begin SSCommand cmdClose 
         BevelWidth      =   3
         Caption         =   "Close Help"
         Font3D          =   1  'Raised w/light shading
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "Arial"
         FontSize        =   8.25
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00000040&
         Height          =   375
         Index           =   0
         Left            =   1245
         TabIndex        =   29
         Top             =   2220
         Width           =   1875
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "O"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   15
         Left            =   495
         TabIndex        =   28
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "P"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   16
         Left            =   870
         TabIndex        =   27
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "Q"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   17
         Left            =   1245
         TabIndex        =   26
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "R"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   18
         Left            =   1620
         TabIndex        =   25
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "S"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   19
         Left            =   1995
         TabIndex        =   24
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "T"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   20
         Left            =   2370
         TabIndex        =   23
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "U"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   21
         Left            =   2745
         TabIndex        =   22
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "V"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   22
         Left            =   3120
         TabIndex        =   21
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "W"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   23
         Left            =   3495
         TabIndex        =   20
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "X"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   24
         Left            =   3870
         TabIndex        =   19
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "Y"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   25
         Left            =   4245
         TabIndex        =   18
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "Z"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   26
         Left            =   4620
         TabIndex        =   17
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "N"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   14
         Left            =   120
         TabIndex        =   16
         Top             =   3300
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "B"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   2
         Left            =   495
         TabIndex        =   15
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "C"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   3
         Left            =   870
         TabIndex        =   14
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "D"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   4
         Left            =   1245
         TabIndex        =   13
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "E"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   5
         Left            =   1620
         TabIndex        =   12
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "F"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   6
         Left            =   1995
         TabIndex        =   11
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "G"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   7
         Left            =   2370
         TabIndex        =   10
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "H"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   8
         Left            =   2745
         TabIndex        =   9
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "I"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   9
         Left            =   3120
         TabIndex        =   8
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "J"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   10
         Left            =   3495
         TabIndex        =   7
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "K"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   11
         Left            =   3870
         TabIndex        =   6
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "L"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   12
         Left            =   4245
         TabIndex        =   5
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "M"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   13
         Left            =   4620
         TabIndex        =   4
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdGlossary 
         Caption         =   "A"
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "MS Sans Serif"
         FontSize        =   9.75
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H00FF0000&
         Height          =   375
         Index           =   1
         Left            =   120
         TabIndex        =   3
         Top             =   2940
         Width           =   375
      End
      Begin SSCommand cmdHelp 
         BevelWidth      =   3
         Caption         =   "Help"
         Font3D          =   4  'Inset w/heavy shading
         FontBold        =   -1  'True
         FontItalic      =   0   'False
         FontName        =   "Arial"
         FontSize        =   18
         FontStrikethru  =   0   'False
         FontUnderline   =   0   'False
         ForeColor       =   &H0000FF00&
         Height          =   735
         Left            =   120
         TabIndex        =   2
         Top             =   2220
         Width           =   1145
      End
      Begin TextBox txtIntro 
         Alignment       =   2  'Center
         BackColor       =   &H00FFFFFF&
         Enabled         =   0   'False
         ForeColor       =   &H00800000&
         Height          =   2115
         HideSelection   =   0   'False
         Left            =   120
         MultiLine       =   -1  'True
         TabIndex        =   1
         TabStop         =   0   'False
         Top             =   120
         Width           =   4860
      End
   End
   Begin Menu menuExit 
      Caption         =   "E&xit"
   End
   Begin Menu mnuCopyright 
      Caption         =   "&Copyright"
   End
   Begin Menu mnuHelp 
      Caption         =   "&Help"
      Begin Menu mnuContents 
         Caption         =   "&Contents"
      End
      Begin Menu mnuSearch 
         Caption         =   "&Search"
      End
      Begin Menu mnuGlossary 
         Caption         =   "&Glossary"
      End
      Begin Menu mnuReadMeFirst 
         Caption         =   "&Read Me First"
      End
      Begin Menu mnuSep1 
         Caption         =   "-"
      End
      Begin Menu mnuHelpOnHelp 
         Caption         =   "&Help On Help"
      End
   End
End

Sub cmdClose_Click (Index As Integer)

Dim macro As String

   If Index = 0 Then
      macro = "CloseWindow(`main')"
   ElseIf Index = 1 Then
      macro = "CloseWindow(`glos_win')"
   ElseIf Index = 3 Then
      macro = "Print()"
   Else
      macro = "CopyDialog()"
   End If

   Call HelpMenu(8, 0, macro)

End Sub

Sub cmdGlossary_Click (Index As Integer)

Dim Letter As String
Dim macro As String

'Letter is equal to the context string we want to jump to

   Letter = Chr$(Index + 96)
   macro = "JumpId(`helpinfo.hlp>glos_win',`" & Letter & "')"
   Call HelpMenu(7, 0, macro)

End Sub

Sub cmdHelp_Click ()

   Call HelpMenu(3, 3, "")

End Sub

Sub Form_Load ()

   crlf$ = Chr$(13) + Chr$(10)

   m$ = "This program illustrates how to intergrate a Windows Help file "
   m$ = m$ & "into a VB program. It has no other function."
   m$ = m$ & crlf$
   m$ = m$ & crlf$
   m$ = m$ & "The best way to learn is to work with the program and then study the "
   m$ = m$ & "source code, which is provided."
   m$ = m$ & crlf$
   m$ = m$ & crlf$
   m$ = m$ & "To start, click the Help button "
   m$ = m$ & "below and also select Read Me First from the Help menu. They show "
   m$ = m$ & "how to access a specific help topic in two ways."

   txtIntro.Text = m$
   
End Sub

Sub HelpMenu (HelpOption As Integer, ContextNum As Long, macro As String)
   
   Select Case HelpOption

      Case 1  'Display the contents topic
         r = WinHelpByNum(frmHelpInfohWnd, App.HelpFile, HELP_CONTENTS, 0)
      
      Case 2  'Display the Search Dialog Box (See Note 1 at bottom.)
         r = WinHelpByStr(frmHelpInfohWnd, App.HelpFile, HELP_PARTIALKEY, "")
         
      Case 3  'Display the Read_Me_First topic using the MAPed context number
         r = WinHelpByNum(frmHelpInfohWnd, App.HelpFile, HELP_CONTEXT, ContextNum)
      
      Case 4  'Display Glossary in secondary window  (See Note 2 at bottom.)
         macro = "JumpId(`" & App.HelpFile & ">glos_win',`glossary')"
         r = WinHelpByNum(frmHelpInfohWnd, App.HelpFile, HELP_FORCEFILE, 0)
         r = WinHelpByStr(frmHelpInfohWnd, App.HelpFile, HELP_COMMAND, macro)
      
      Case 5  'Help on Help
         r = WinHelpByNum(frmHelpInfohWnd, "dummy", HELP_HELPONHELP, 0)

      Case 6  'Terminate the Help file. (Make sure to do this before exiting the application.)
         r = WinHelpByNum(frmHelpInfohWnd, App.HelpFile, HELP_QUIT, 0)
      
      Case 7  'Execute jump macro to specific glossary letter and close the main help window. This is a generalization of Case 4.
         r = WinHelpByNum(frmHelpInfohWnd, App.HelpFile, HELP_FORCEFILE, 0)
         r = WinHelpByStr(frmHelpInfohWnd, App.HelpFile, HELP_COMMAND, macro)
         r = WinHelpByStr(frmHelpInfohWnd, App.HelpFile, HELP_COMMAND, "CloseWindow(`main')")

      Case 8  'Execute macro
         r = WinHelpByStr(frmHelpInfohWnd, App.HelpFile, HELP_COMMAND, macro)

   End Select

'*******************************************************************
'NOTE 1
'      The "traditional" way you might think to invoke the Search Dialog Box is to
'      use the HELP_COMMAND and pass the Search macro, as in the statement below:

'         r = WinHelpByStr(frmHelpInfohWnd, App.HelpFile, HELP_COMMAND, "Search()")
'
'      This works fine, the Help file is started and the content topic displayed. Then
'      the Search Dialog Box is brought up, as if the user had clicked the Search
'      Button.

'      A better way (I think), and the way VB Help works, is to use the HELP_PARTIALKEY
'      command and pass a null string keyword, as in Case 2 above. Using this
'      method, the Search Dialog Box is brought up in the calling application. After
'      the user selects a topic, that topic is displayed directly, bypassing the
'      content topic.

'NOTE 2
'      It is not possible to display a secondary window, without first displaying the
'      main window (as far as I can figure out), which is what the HELP_FORCEFILE does.
'      (If anybody knows different, please pass it on to me.)

End Sub

Sub menuExit_Click ()

   Call HelpMenu(6, 0, "")

   End

End Sub

Sub mnuContents_Click ()

   Call HelpMenu(1, 0, "")

End Sub

Sub mnuCopyright_Click ()

   t$ = "Copyright ©1993 Crunch Software Corporation"
   
   m$ = m$ & "This file and all ancillary materials that came with it are copyrighted. You "
   m$ = m$ & "are granted a royalty-free right to incorporate these works, in whole or in "
   m$ = m$ & "part, into other products, so long as you don't hold Crunch Software "
   m$ = m$ & "responsible. You may distribute these materials as you see fit, on a non-"
   m$ = m$ & "commercial basis. However, you must distribute all the files together."

   MsgBox m$, 64, t$

End Sub

Sub mnuGlossary_Click ()
   
   Call HelpMenu(4, 0, "")

End Sub

Sub mnuHelpOnHelp_Click ()

   Call HelpMenu(5, 0, "")

End Sub

Sub mnuReadMeFirst_Click ()

   Call HelpMenu(3, 3, "")

End Sub

Sub mnuSearch_Click ()

   Call HelpMenu(2, 0, "")

End Sub

