home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / demo / truegrid / trubrwse / trubrwse.$ / WINHELP.BAS < prev   
BASIC Source File  |  1994-02-08  |  2KB  |  72 lines

  1. ' The TrueGrid Sample Application
  2.  
  3. ' WINHELP.BAS - This module contains Windows API declarations and
  4. ' utility routines that provide access to the WinHelp application.
  5.  
  6. Const HELP_CONTEXT = &H1
  7. Const HELP_HELPONHELP = &H4
  8. Const HELP_QUIT = &H2
  9.  
  10.  
  11. ' Help context IDs for sample applications
  12. Global Const HELP_TRUEBROWSER = 1000
  13. Global Const HELP_DBTABLE = 1001
  14. Global Const HELP_LINKGRID = 1002
  15. Global Const HELP_MARKGRID = 1003
  16.  
  17. Declare Function WinHelp Lib "User" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData As Any) As Integer
  18.  
  19. Sub HelpQuit (This As Form)
  20.   R = WinHelp(This.hWnd, dummy$, HELP_QUIT, CLng(0))
  21. End Sub
  22.  
  23. Function GetHelpFile () As String
  24.  
  25.     GetHelpFile = ""
  26.  
  27.     Wh$ = TrueGridWhere$()
  28.  
  29.     On Error GoTo tryagain
  30.     
  31.     H$ = Wh$ + "truegrid.hlp"
  32.     I$ = Dir$(H$)
  33.     GetHelpFile = H$
  34.  
  35.     Exit Function
  36.  
  37. tryagain:
  38.     H$ = App.Path + "\truegrid.hlp"
  39.     
  40.     If Dir$(H$) = "" Then
  41.         GetHelpFile = ""
  42.     Else
  43.         GetHelpFile = H$
  44.     End If
  45.     Exit Function
  46.  
  47. End Function
  48.  
  49. Sub HelpContext (This As Form, Context As Integer)
  50.  
  51. ' Display a particular frame of the TrueGrid help file, if found in
  52. ' the product installation directory or the application directory
  53.  
  54.     H$ = GetHelpFile()
  55.  
  56.     If H$ <> "" Then
  57.         Z% = WinHelp(This.hWnd, H$, HELP_CONTEXT, CLng(Context))
  58.     Else
  59.         MsgBox "Can't find TrueGrid help file", MB_ICONEXCLAMATION
  60.     End If
  61.  
  62. End Sub
  63.  
  64. Sub HelpOnHelp (This As Form)
  65.  
  66. ' Display instructions for using WinHelp
  67.  
  68.     Z% = WinHelp(This.hWnd, dummy$, HELP_HELPONHELP, CLng(0))
  69.  
  70. End Sub
  71.  
  72.