-
Notifications
You must be signed in to change notification settings - Fork 2
/
ContxtID.BAS
107 lines (99 loc) · 5.06 KB
/
ContxtID.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Attribute VB_Name = "Module1"
Option Explicit
'=====================================================================
'=====================================================================
'
'This source code contains the following routines:
' o SetAppHelp() 'Called in the main Form_Load event to register your
' 'program with WINHELP.EXE
' o QuitHelp() 'Deregisters your program with WINHELP.EXE. Should
' 'be called in your main Form_Unload event
' o ShowHelpTopic(Topicnum) 'Brings up context sensitive help based on
' 'any of the following CONTEXT IDs
' o ShowContents 'Displays the startup topic
' o HelpWindowSize(x,y,dx,dy) ' Position help window in a screen
' ' independent manner
' o SearchHelp() 'Brings up the windows help KEYWORD SEARCH dialog box
'***********************************************************************
'
'=====================================================================
'List of Context IDs for <jspad>
'=====================================================================
'
'
' Help engine section.
' Commands to pass WinHelp()
'Global Const HELP_CONTEXT = &H1 ' Display topic in ulTopic
Private Const HELP_QUIT = &H2 ' Terminate help
'Global Const HELP_FINDER = &HB ' Display Contents tab
'Global Const HELP_INDEX = &H3 ' Display index
'Global Const HELP_HELPONHELP = &H4 ' Display help on using help
'Global Const HELP_SETINDEX = &H5 ' Set the current Index for multi index help
'Global Const HELP_KEY = &H101 ' Display topic for keyword in offabData
'Global Const HELP_MULTIKEY = &H201
Private Const HELP_CONTENTS = &H3 ' Display Help for a particular topic
'Global Const HELP_SETCONTENTS = &H5 ' Display Help contents topic
'Global Const HELP_CONTEXTPOPUP = &H8 ' Display Help topic in popup window
'Global Const HELP_FORCEFILE = &H9 ' Ensure correct Help file is displayed
'Global Const HELP_COMMAND = &H102 ' Execute Help macro
Private Const HELP_PARTIALKEY = &H105 ' Display topic found in keyword list
'Global Const HELP_SETWINPOS = &H203 ' Display and position Help window
Type HELPWININFO
wStructSize As Long
x As Long
y As Long
dx As Long
dy As Long
wMax As Long
rgChMember As String * 2
End Type
Declare Function WinHelp Lib "User32.dll" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Any) As Long
'Declare Function WinHelpByInfo Lib "User32.dll" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, dwData As HELPWININFO) As Long
'Declare Function WinHelpByStr Lib "User32.dll" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData$) As Long
Private Declare Function WinHelpByNum Lib "User32.dll" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData&) As Long
Dim m_hWndMainWindow As Long ' hWnd to tell WINHELP the helpfile owner
'Dim MainWindowInfo As HELPWININFO
Public Sub SetAppHelp(ByVal hWndMainWindow)
'=====================================================================
'To use these subroutines to access WINHELP, you need to add
'at least this one subroutine call to your code
' o In the Form_Load event of your main Form enter:
' Call SetAppHelp(Me.hWnd) 'To setup helpfile variables
' (If you are not interested in keyword searching or context
' sensitive help, this is the only call you need to make!)
'=====================================================================
m_hWndMainWindow = hWndMainWindow
If VBA.Right$(Trim$(App.path), 1) = "\" Then
App.HelpFile = App.path + "help\jsplus.hlp"
Else
App.HelpFile = App.path + "\help\jsplus.hlp"
End If
' MainWindowInfo.wStructSize = 26
' MainWindowInfo.x = 256
' MainWindowInfo.y = 256
' MainWindowInfo.dx = 512
' MainWindowInfo.dy = 512
' MainWindowInfo.rgChMember = Chr$(0) + Chr$(0)
End Sub
Public Sub QuitHelp()
Dim Result As Variant
Result = WinHelp(m_hWndMainWindow, App.HelpFile, HELP_QUIT, Chr$(0) + Chr$(0) + Chr$(0) + Chr$(0))
End Sub
Public Sub ShowHelpContents()
'=====================================================================
' DISPLAY STARTUP TOPIC IN RESPONSE TO A COMMAND BUTTON or MENU ...
'=====================================================================
'
Dim Result As Variant
Result = WinHelpByNum(m_hWndMainWindow, App.HelpFile, HELP_CONTENTS, CLng(0))
End Sub
Public Sub SearchHelp()
'=====================================================================
' TO ADD KEYWORD SEARCH CAPABILITY...
'=====================================================================
' o In your Help|Search menu selection, simply enter:
' Call SearchHelp() 'To invoke helpfile keyword search dialog
'
Dim Result As Variant
Result = WinHelp(m_hWndMainWindow, App.HelpFile, HELP_PARTIALKEY, ByVal "")
End Sub