-
Notifications
You must be signed in to change notification settings - Fork 2
/
CONTXTID.BAS
245 lines (218 loc) · 10.9 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
Attribute VB_Name = "ContextIDs"
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 <SymphonyX>
'=====================================================================
Global Const Hlp_Query_x = 10 'Main Help Window
Global Const Hlp_SymphonyX_ = 20 'Main Help Window
Global Const Hlp_Archivo_ = 310 'Main Help Window
Global Const Hlp_Edicixn_ = 320 'Main Help Window
Global Const Hlp_Query_ = 330 'Main Help Window
Global Const Hlp_Archivo_1 = 340 'Main Help Window
Global Const Hlp_Opciones_ = 350 'Main Help Window
Global Const Hlp_Ventana_ = 360 'Main Help Window
Global Const Hlp_Ayuda_ = 370 'Main Help Window
Global Const Hlp_Tablas_ = 380 'Main Help Window
Global Const Hlp_Barra_de = 390 'Main Help Window
Global Const Hlp_Acerca_de = 400 'Main Help Window
Global Const Hlp_Configuracixn_de = 410 'Main Help Window
Global Const Hlp_Skin_ = 420 'Main Help Window
Global Const Hlp_Browser_ = 430 'Main Help Window
Global Const Hlp_Form1_ = 440 'Main Help Window
Global Const Hlp_Conectar_xxx = 450 'Main Help Window
Global Const Hlp_Presentacixn_Preliminar = 460 'Main Help Window
Global Const Hlp_Imprimir_ = 470 'Main Help Window
Global Const Hlp_Browser_de = 480 'Main Help Window
Global Const Hlp_Visor_de = 490 'Main Help Window
Global Const Hlp_Sugerencia_del = 500 'Main Help Window
'=====================================================================
'
'
' Help engine section.
' Commands to pass WinHelp()
Global Const HELP_CONTEXT = &H1 ' Display topic in ulTopic
Global 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
Global 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
Global 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
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 Right$(Trim$(App.Path),1) = "\" then
App.HelpFile = App.Path + "SymphonyX.HLP"
else
App.HelpFile = App.Path + "\SymphonyX.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 ShowHelpTopic (ByVal ContextID As Long)
'=====================================================================
' FOR CONTEXT SENSITIVE HELP IN RESPONSE TO A COMMAND BUTTON ...
'=====================================================================
' o For 'Help button' controls, you can call:
' Call ShowHelpTopic(<any Hlpxxx entry above>)
'=====================================================================
' TO ADD FORM LEVEL CONTEXT SENSITIVE HELP...
'=====================================================================
' o For FORM level context sensetive help, you should set each
' Me.HelpContext=<any Hlp_xxx entry above>
'
Dim Result as Variant
Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXT, Clng(ContextID))
End Sub
Public Sub ShowHelpTopic2 (ByVal ContextID As Long)
'=====================================================================
' DISPLAY CONTEXT SENSITIVE HELP IN WINDOW 2 ...
'=====================================================================
' o For 'Help button' controls, you can call:
' Call ShowHelpTopic2(<any Hlpxxx entry above>)
'
Dim Result as Variant
Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile &">HlpWnd02", HELP_CONTEXT, Clng(ContextID))
End Sub
Public Sub ShowHelpTopic3 (ByVal ContextID As Long)
'=====================================================================
' DISPLAY CONTEXT SENSITIVE HELP IN WINDOW 3 ...
'=====================================================================
' o For 'Help button' controls, you can call:
' Call ShowHelpTopic3(<any Hlpxxx entry above>)
'
Dim Result as Variant
Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile &">HlpWnd03", HELP_CONTEXT, Clng(ContextID))
End Sub
Public Sub ShowGlossary ()
Dim Result as Variant
Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXT, Clng(64000))
End Sub
Public Sub ShowPopupHelp (ByVal ContextID As Long)
'=====================================================================
' FOR POPUP HELP IN RESPONSE TO A COMMAND BUTTON ...
'=====================================================================
Dim Result as Variant
Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXTPOPUP, Clng(ContextID))
End Sub
Public Sub DoHelpMacro (ByVal MacroString As String)
'=====================================================================
' FOR POPUP HELP IN RESPONSE TO A COMMAND BUTTON ...
'=====================================================================
Dim Result as Variant
Result = WinHelpByStr(m_hWndMainWindow, APP.HelpFile, HELP_COMMAND, ByVal(Macrostring))
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 ShowContentsTab ()
'=====================================================================
' DISPLAY Contents tab (*.CNT)
'=====================================================================
'
Dim Result as Variant
Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_FINDER, Clng(0))
End Sub
Public Sub ShowHelpOnHelp ()
'=====================================================================
' DISPLAY HELP for WINHELP.EXE ...
'=====================================================================
'
Dim Result as Variant
Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_HELPONHELP, 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
Public Sub SearchHelpKeyWord (Argument as String)
'=====================================================================
' 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 Trim$(Argument))
End Sub
Public Sub HelpWindowSize (x As Integer, y As Integer, wx As Integer, wy As Integer)
'=====================================================================
' TO SET THE SIZE AND POSITION OF THE MAIN HELP WINDOW...
'=====================================================================
' o Call HelpWindowSize(x, y, dx, dy), where:
' x = 1-1024 (position from left edge of screen)
' y = 1-1024 (position from top of screen)
' dx= 1-1024 (width)
' dy= 1-1024 (height)
'
Dim Result as Variant
MainWindowInfo.x = x
MainWindowInfo.y = y
MainWindowInfo.dx = wx
MainWindowInfo.dy = wy
Result = WinHelpByInfo(m_hWndMainWindow, App.HelpFile, HELP_SETWINPOS, MainWindowInfo)
End Sub