home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / DATABASE.ZIP / AxButtonCombo / help / ContxtID.BAS < prev   
Encoding:
BASIC Source File  |  1999-01-19  |  10.8 KB  |  247 lines

  1. Option Explicit
  2. '=====================================================================
  3. '=====================================================================
  4. '
  5. 'This source code contains the following routines:
  6. '  o SetAppHelp() 'Called in the main Form_Load event to register your
  7. '                 'program with WINHELP.EXE
  8. '  o QuitHelp()    'Deregisters your program with WINHELP.EXE. Should
  9. '                  'be called in your main Form_Unload event
  10. '  o ShowHelpTopic(Topicnum) 'Brings up context sensitive help based on
  11. '                  'any of the following CONTEXT IDs
  12. '  o ShowContents  'Displays the startup topic
  13. '  o HelpWindowSize(x,y,dx,dy) ' Position help window in a screen
  14. '                              ' independent manner
  15. '  o SearchHelp()  'Brings up the windows help KEYWORD SEARCH dialog box
  16. '***********************************************************************
  17. '
  18. '=====================================================================
  19. 'List of Context IDs for <axButton>
  20. '=====================================================================
  21. Global Const Hlp_Contents = 10    'Main Help Window
  22. Global Const Hlp_Revisions = 30    'Main Help Window
  23. Global Const Hlp_License = 40    'Main Help Window
  24. Global Const Hlp_Tech_Support = 50    'Main Help Window
  25. Global Const Hlp_Properties = 60    'Second Help Window
  26. Global Const Hlp_Methods = 70    'Second Help Window
  27. Global Const Hlp_Events = 80    'Second Help Window
  28. Global Const Hlp_Standard = 90    'Main Help Window
  29. Global Const Hlp_ColorDarkShadow = 100    'Second Help Window
  30. Global Const Hlp_ColorHighlight = 110    'Second Help Window
  31. Global Const Hlp_ColorLightShadow = 120    'Second Help Window
  32. Global Const Hlp_DownPicture = 130    'Second Help Window
  33. Global Const Hlp_DropDown = 140    'Second Help Window
  34. Global Const Hlp_FlatPicture = 150    'Second Help Window
  35. Global Const Hlp_MaskColor = 160    'Second Help Window
  36. Global Const Hlp_Picture = 170    'Second Help Window
  37. Global Const Hlp_PictureAlign = 180    'Second Help Window
  38. Global Const Hlp_ShowFlatGrey = 190    'Second Help Window
  39. Global Const Hlp_Style = 200    'Second Help Window
  40. Global Const Hlp_ShowAbout = 210    'Second Help Window
  41. Global Const Hlp_DropDownClick = 230    'Second Help Window
  42. Global Const Hlp_ButtonGroup = 240    'Second Help Window
  43. Global Const Hlp_ButtonGroupDefault = 250    'Second Help Window
  44. '=====================================================================
  45. '
  46. '
  47. '  Help engine section.
  48.  
  49. ' Commands to pass WinHelp()
  50. Global Const HELP_CONTEXT = &H1 '  Display topic in ulTopic
  51. Global Const HELP_QUIT = &H2    '  Terminate help
  52. Global Const HELP_FINDER = &HB  '  Display Contents tab
  53. Global Const HELP_INDEX = &H3   '  Display index
  54. Global Const HELP_HELPONHELP = &H4      '  Display help on using help
  55. Global Const HELP_SETINDEX = &H5        '  Set the current Index for multi index help
  56. Global Const HELP_KEY = &H101           '  Display topic for keyword in offabData
  57. Global Const HELP_MULTIKEY = &H201
  58. Global Const HELP_CONTENTS = &H3     ' Display Help for a particular topic
  59. Global Const HELP_SETCONTENTS = &H5  ' Display Help contents topic
  60. Global Const HELP_CONTEXTPOPUP = &H8 ' Display Help topic in popup window
  61. Global Const HELP_FORCEFILE = &H9    ' Ensure correct Help file is displayed
  62. Global Const HELP_COMMAND = &H102    ' Execute Help macro
  63. Global Const HELP_PARTIALKEY = &H105 ' Display topic found in keyword list
  64. Global Const HELP_SETWINPOS = &H203  ' Display and position Help window
  65.  
  66.  
  67. Type HELPWININFO
  68.   wStructSize As Integer
  69.   X As Integer
  70.   Y As Integer
  71.   dX As Integer
  72.   dY As Integer
  73.   wMax As Integer
  74.   rgChMember As String * 2
  75. End Type
  76.     Declare Function WinHelp Lib "User" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData As Any) As Integer
  77.     Declare Function WinHelpByInfo Lib "User" Alias "WinHelp" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, dwData As HELPWININFO) As Integer
  78.     Declare Function WinHelpByStr Lib "User" Alias "Winhelp" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData$) As Integer
  79.     Declare Function WinHelpByNum Lib "User" Alias "Winhelp" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData&) As Integer
  80.  
  81.     Dim m_hWndMainWindow as Integer ' hWnd to tell WINHELP the helpfile owner
  82. Dim MainWindowInfo as HELPWININFO
  83. Sub SetAppHelp (ByVal hWndMainWindow)
  84. '=====================================================================
  85. 'To use these subroutines to access WINHELP, you need to add
  86. 'at least this one subroutine call to your code
  87. '     o  In the Form_Load event of your main Form enter:
  88. '        Call SetAppHelp(Me.hWnd) 'To setup helpfile variables
  89. '         (If you are not interested in keyword searching or context
  90. '         sensitive help, this is the only call you need to make!)
  91. '=====================================================================
  92.     m_hWndMainWindow = hWndMainWindow
  93.     If Right$(Trim$(App.Path),1) = "\" then
  94.         App.HelpFile = App.Path + "axButton.HLP"
  95.     else
  96.         App.HelpFile = App.Path + "\axButton.HLP"
  97.     end if
  98. MainWindowInfo.wStructSize = 14
  99.     MainWindowInfo.X=256
  100.     MainWindowInfo.Y=256
  101.     MainWindowInfo.dX=512
  102.     MainWindowInfo.dY=512
  103.     MainWindowInfo.rgChMember=Chr$(0)+Chr$(0)
  104. End Sub
  105. Sub QuitHelp ()
  106.     Dim Result as Variant
  107.     Result = WinHelp(m_hWndMainWindow, App.HelpFile, HELP_QUIT, Chr$(0) + Chr$(0) + Chr$(0) + Chr$(0))
  108. End Sub
  109. Sub ShowHelpTopic (ByVal ContextID As Long)
  110. '=====================================================================
  111. '  FOR CONTEXT SENSITIVE HELP IN RESPONSE TO A COMMAND BUTTON ...
  112. '=====================================================================
  113. '     o   For 'Help button' controls, you can call:
  114. '         Call ShowHelpTopic(<any Hlpxxx entry above>)
  115. '=====================================================================
  116. '  TO ADD FORM LEVEL CONTEXT SENSITIVE HELP...
  117. '=====================================================================
  118. '     o  For FORM level context sensetive help, you should set each 
  119. '        Me.HelpContext=<any Hlp_xxx entry above>
  120. '
  121.     Dim Result as Variant
  122.  
  123.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXT, Clng(ContextID))
  124.  
  125. End Sub
  126. Sub ShowHelpTopic2 (ByVal ContextID As Long)
  127. '=====================================================================
  128. '  DISPLAY CONTEXT SENSITIVE HELP IN WINDOW 2 ...
  129. '=====================================================================
  130. '     o   For 'Help button' controls, you can call:
  131. '         Call ShowHelpTopic2(<any Hlpxxx entry above>)
  132. '
  133.     Dim Result as Variant
  134.  
  135.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile &">HlpWnd02", HELP_CONTEXT, Clng(ContextID))
  136.  
  137. End Sub
  138. Sub ShowHelpTopic3 (ByVal ContextID As Long)
  139. '=====================================================================
  140. '  DISPLAY CONTEXT SENSITIVE HELP IN WINDOW 3 ...
  141. '=====================================================================
  142. '     o   For 'Help button' controls, you can call:
  143. '         Call ShowHelpTopic3(<any Hlpxxx entry above>)
  144. '
  145.     Dim Result as Variant
  146.  
  147.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile &">HlpWnd03", HELP_CONTEXT, Clng(ContextID))
  148.  
  149. End Sub
  150. Sub ShowGlossary ()
  151.     Dim Result as Variant
  152.  
  153.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXT, Clng(64000))
  154.  
  155. End Sub
  156. Sub ShowPopupHelp (ByVal ContextID As Long)
  157. '=====================================================================
  158. '  FOR POPUP HELP IN RESPONSE TO A COMMAND BUTTON ...
  159. '=====================================================================
  160.     Dim Result as Variant
  161.  
  162.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXTPOPUP, Clng(ContextID))
  163.  
  164. End Sub
  165. Sub DoHelpMacro (ByVal MacroString As String)
  166. '=====================================================================
  167. '  FOR POPUP HELP IN RESPONSE TO A COMMAND BUTTON ...
  168. '=====================================================================
  169.     Dim Result as Variant
  170.  
  171.     Result = WinHelpByStr(m_hWndMainWindow, APP.HelpFile, HELP_COMMAND, ByVal(Macrostring))
  172.  
  173. End Sub
  174. Sub ShowHelpContents ()
  175. '=====================================================================
  176. '  DISPLAY STARTUP TOPIC IN RESPONSE TO A COMMAND BUTTON or MENU ...
  177. '=====================================================================
  178. '
  179.     Dim Result as Variant
  180.  
  181.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTENTS, Clng(0))
  182.  
  183. End Sub
  184. Sub ShowContentsTab ()
  185. '=====================================================================
  186. '  DISPLAY Contents tab (*.CNT)
  187. '=====================================================================
  188. '
  189.     Dim Result as Variant
  190.  
  191.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_FINDER, Clng(0))
  192.  
  193. End Sub
  194. Sub ShowHelpOnHelp ()
  195. '=====================================================================
  196. '  DISPLAY HELP for WINHELP.EXE  ...
  197. '=====================================================================
  198. '
  199.     Dim Result as Variant
  200.  
  201.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_HELPONHELP, Clng(0))
  202.  
  203. End Sub
  204.  
  205. Sub SearchHelp ()
  206. '=====================================================================
  207. '  TO ADD KEYWORD SEARCH CAPABILITY...
  208. '=====================================================================
  209. '     o   In your Help|Search menu selection, simply enter:
  210. '         Call SearchHelp() 'To invoke helpfile keyword search dialog
  211. '
  212.     Dim Result as Variant
  213.  
  214.     Result = WinHelp(m_hWndMainWindow, APP.HelpFile, HELP_PARTIALKEY, ByVal "" )
  215.  
  216. End Sub
  217.  
  218. Sub SearchHelpKeyWord (Argument as String)
  219. '=====================================================================
  220. '  TO ADD KEYWORD SEARCH CAPABILITY...
  221. '=====================================================================
  222. '     o   In your Help|Search menu selection, simply enter:
  223. '         Call SearchHelp() 'To invoke helpfile keyword search dialog
  224. '
  225.     Dim Result as Variant
  226.  
  227.     Result = WinHelp(m_hWndMainWindow, APP.HelpFile, HELP_PARTIALKEY, ByVal Trim$(Argument))
  228.  
  229. End Sub
  230. Sub HelpWindowSize (x As Integer, y As Integer, wx As Integer, wy As Integer)
  231. '=====================================================================
  232. '  TO SET THE SIZE AND POSITION OF THE MAIN HELP WINDOW...
  233. '=====================================================================
  234. '     o   Call HelpWindowSize(x, y, dx, dy), where:
  235. '             x = 1-1024 (position from left edge of screen)
  236. '             y = 1-1024 (position from top of screen)
  237. '             dx= 1-1024 (width)
  238. '             dy= 1-1024 (height)
  239. '
  240.     Dim Result as Variant
  241.     MainWindowInfo.x = x
  242.     MainWindowInfo.y = y
  243.     MainWindowInfo.dx = wx
  244.     MainWindowInfo.dy = wy
  245.     Result = WinHelpByInfo(m_hWndMainWindow, App.HelpFile, HELP_SETWINPOS, MainWindowInfo)
  246. End Sub
  247.