summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/mstest.inc
blob: d5d8e0a69bddd2396399e444cdaec7cba0366da6 (plain) (blame)
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
'--------------------------------------------------------------------------
'
'  MSTEST.INC Version 2.00
'  API Declarations for TEST Tools
'
'  NOTE: All API are ALIAS'd to themselves to support NT
'        API Not yet supported under NT are IFDEF'd out using the
'        predefine symbol of NT.
'
'  To include the various portions of this file, any combination of the
'  following $DEFINE's must be used in your script prior to $INCLUDEing
'  MSTEST.INC:
'
'  i.e. IN YOUR SCRIPT add a line such as the following to DEFINE one of
'       the SYMBOLS below, so you only include what you need.
'
'  REM$ DEFINE MSTest         - to get everything in this include file
'  REM$ DEFINE TestCtrl       - to get ALL the TESTCTRL declarations etc.
'  REM$ DEFINE TestScrn       - to get ALL the TESTSCRN declarations etc.
'  REM$ DEFINE TestDlgs       - to get ALL the TESTDLGS declarations etc.
'  REM$ DEFINE TestEvnt       - to get ALL the TESTEVNT declarations etc.
'  REM$ DEFINE TestUI         - to get ALL the TESTUI   declarations etc.
'
' OR USE ANY OF THE FOLLOWING SYMBOLS TO GET PARTIAL
'
'     MSTEST: includes all of MSTEST.INC
'
'         TESTCTRL: includes all of TESTCTRL
'             W_MISC    TESTCTRL Miscellaneous routines
'             W_WINDOW  TESTCTRL Window routines
'             W_MENU    TESTCTRL Menu routines
'             W_ERROR:  TESTCTRL error routines
'             W_CONTROL: includes all of the control declares & routines
'                 W_BUTTON:  includes all of the BUTTON declares etc.
'                 W_CHECK:             "         CHECKBOX
'                 W_OPTION             "         OPTION BUTTON
'                 W_EDIT               "         EDIT CONTROL
'                 W_LIST               "         LIST BOX
'                 W_COMBO              "         COMBO BOX
'
'         TESTSCRN:  includes all of TESTSCRN, Declares & Error codes
'             TESTSCRN_DECL: includes all SCR Declares
'             TESTSCRN_ERRS: includes all SCR Error codes
'
'         TESTDLGS: includes all of TESTDLGS, Declares & Error codes
'             TESTDLGS_DECL: includes all DLGS Declares
'             TESTDLGS_ERRS: includes all DLGS Error codes
'
'         TESTEVNT: includes all TESTEVNT Declares
'
'     W_ERROR_TRAP: Just like W_ERROR, but includes a generic
'                   WErrorTrap to display WError and ErrorText
'                   NOTE: This is not included from any other define.
'
'  NOTE: Including MSTEST.INC without out using any of the above $DEFINE's
'        will include only TESTDRVR.EXE trappable and untrappable error
'        codes, and declares for CRLF, TRUE (-1), FALSE(0), Key values for
'        DoKeys() from TESTEVNT and few routines from TESTCtrl.
'
'---------------------------------------------------------------------------
'
'              Copyright (C) 1991-1992 Microsoft Corporation
'
'  You have a royalty-free right to use, modify, reproduce and distribute
'  this file (and/or any modified version) in any way you find useful,
'  provided that you agree that Microsoft has no warranty, obligation or
'  liability for its contents.  Refer to the Microsoft Windows Programmer's
'  Reference for further information.
'
'  This file is not garanteed by Microsoft to be error free.  Every effort
'  has been made to ensure proper data-types and declarations etc., but no
'  testing has been performed using this include file.  Additionally, some
'  API's, though listed, may not be compatible with the TESTDrvr language.
'
'----------------------------------------------------------------------------

'                                                       *********************
'$IFNDEF MSTEST_INCLUDED
'$DEFINE MSTEST_INCLUDED
'                                                       *********************

'----------------------------------------------------------------------------
' Generic Global Variables
'----------------------------------------------------------------------------
Global CRLF As String        ' UNDONE: Change to Const X = Chr$()
CRLF = Chr$(13) + Chr$(10)   '         once supported

Const TRUE  = -1
Const FALSE = 0


'----------------------------------------------------------------------------
' Unrecoverable TESTDRVR error codes
'----------------------------------------------------------------------------
Const ERR_STACK_OVERFLOW         = 0
Const ERR_STACK_UNDERFLOW        = 1
Const ERR_OUT_OF_STRING_SPACE    = 2
Const ERR_CANT_LOAD_TESTVIEW_DLL = 3
Const ERR_OUT_OF_MEMORY          = 4


'----------------------------------------------------------------------------
' Recoverable TESTDRVR error codes
'----------------------------------------------------------------------------
Const ERR_GOSUB_STACK_OVERFLOW   = 5
Const ERR_RETURN_WITHOUT_GOSUB   = 6
Const ERR_BAD_FILE_NUMBER        = 7
Const ERR_FILE_IO                = 8
Const ERR_RUN_CMD_TOO_LONG       = 9
Const ERR_SHELL_CMD_TOO_LONG     = 10
Const ERR_SETFILE                = 11
Const ERR_FILE_NUMBER_IN_USE     = 12
Const ERR_CANT_OPEN_FILE         = 13
Const ERR_ILLEGAL_FUNCTION_CALL  = 14
Const ERR_INVALID_PATH           = 15
Const ERR_INVALID_DRIVE          = 16
Const ERR_NO_CURRENT_WORKING_DIR = 17
Const ERR_BAD_RUN_CMD            = 18
Const ERR_DIVISION_BY_ZERO       = 19
Const ERR_CANT_LOAD_DLL          = 20
Const ERR_PROC_NOT_FOUND_IN_DLL  = 21
Const ERR_CANNOT_RESUME          = 22
Const ERR_MEM_ALLOC              = 23
Const ERR_INVALID_POINTER        = 24
Const ERR_INVALID_ALLOC_SIZE     = 25
Const ERR_NULL_PIONTER_REF       = 26
Const ERR_SUBSCRIPT_RANGE        = 27
Const ERR_INPUT_PAST_EOF         = 28
Const ERR_FILELIST_PROC          = 29
Const ERR_INVALID_ATTRIBUTE      = 30

'$ifdef WINUSER_SHOW_COMMANDS AND NOT NT

'----------------------------------------------------------------------------
' RUN statement Show commands: RUN "command"[, [NOWAIT][, ShowCommand]]
' NOTE:  These are the same as the SW_ constants in Windows.h
'----------------------------------------------------------------------------
Const SW_HIDE            = 0
Const SW_SHOWNORMAL      = 1
Const SW_NORMAL          = 1
Const SW_SHOWMINIMIZED   = 2
Const SW_SHOWMAXIMIZED   = 3
Const SW_MAXIMIZE        = 3
Const SW_SHOWNOACTIVATE  = 4
Const SW_SHOW            = 5
Const SW_MINIMIZE        = 6
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA          = 8
Const SW_RESTORE         = 9

'$endif WINUSER_SHOW_COMMANDS AND NOT NT

'----------------------------------------------------------------------------
' Key contants used with WKey, PlayKeys, & PlayKeyshWnd
'----------------------------------------------------------------------------
Const K_ENTER  = "{ENTER}"
Const K_ESC    = "{ESC}"
Const K_UP     = "{UP}"
Const K_DOWN   = "{DOWN}"
Const K_LEFT   = "{LEFT}"
Const K_RIGHT  = "{RIGHT}"
Const K_END    = "{END}"
Const K_PGUP   = "{PGUP}"
Const K_PGDN   = "{PGDN}"
Const K_INSERT = "{INSERT}"
Const K_INS    = "{INSERT}"
Const K_DELETE = "{DELETE}"
Const K_DEL    = "{DELETE}"
Const K_HOME   = "{HOME}"
Const K_TAB    = "{TAB}"
Const K_BS     = "{BS}"
Const K_F1     = "{F1}"
Const K_F2     = "{F2}"
Const K_F3     = "{F3}"
Const K_F4     = "{F4}"
Const K_F5     = "{F5}"
Const K_F6     = "{F6}"
Const K_F7     = "{F7}"
Const K_F8     = "{F8}"
Const K_F9     = "{F9}"
Const K_F10    = "{F10}"
Const K_F11    = "{F11}"
Const K_F12    = "{F12}"
Const K_F13    = "{F13}"
Const K_F14    = "{F14}"
Const K_F15    = "{F15}"
Const K_F16    = "{F16}"
Const K_SHIFT  = "+"
Const K_CTRL   = "^"
Const K_ALT    = "%"

' TESTCtrl API & Constants that are always declared.
'
' WGetFocus() simply preforms the exact function as the windows
' GetFocus() API.  Is contained in TESTCtrl since it is such a
' commonly used API in scripts, and it makes it much easier to
' use since it is defined simply by including MSTEST.INC.  It is
' renamed to prevent duplicate definitions due to scripts that
' do define GetFocus() and include MSTEST.INC.
'---------------------------------------------------------------
Declare Function WGetFocus    Lib "TESTCtrl.dll" Alias "WGetFocus"    () As Integer
Declare Sub      WSetActWnd   Lib "TESTCtrl.dll" Alias "WSetActWnd"   (hWnd%)
Declare Function WGetActWnd   Lib "TESTCtrl.dll" Alias "WGetActWnd"   (hWnd%) As Integer
Declare Function WFndWnd      Lib "TESTCtrl.dll" Alias "WFndWnd"      (lpszCaption$, wFlags%) As Integer
Declare Function WFndWndC     Lib "TESTCtrl.dll" Alias "WFndWndC"     (lpszText$, lpszClass$, wFlags%) As Integer
Declare Function WFndWndWait  Lib "TESTCtrl.dll" Alias "WFndWndWait"  (lpszCaption$, wFlags%, wSeconds%) As Integer
Declare Function WFndWndWaitC Lib "TESTCtrl.dll" Alias "WFndWndWaitC" (lpszText$, lpszClass$, wFlags%, wSeconds%) As Integer

Const FW_DEFAULT     = &h0000  'Default
Const FW_RESTOREICON = &h0081  '&h0080 Or FW_FOCUS
Const FW_NOEXIST     = &h0040
Const FW_EXIST       = &h0000  'Default
Const FW_CHILDNOTOK  = &h0020
Const FW_CHILDOK     = &h0000  'Default
Const FW_HIDDENOK    = &h0010
Const FW_HIDDENNOTOK = &h0000  'Default
Const FW_ACTIVE      = &h0008
Const FW_ALL         = &h0000  'Default
Const FW_CASE        = &h0004
Const FW_NOCASE      = &h0000  'Default
Const FW_PART        = &h0002
Const FW_FULL        = &h0000  'Default
Const FW_FOCUS       = &h0001
Const FW_NOFOCUS     = &h0000  'Default

' TESTEvnt API that are always defined.
'--------------------------------------
Declare Sub DoKeys     Lib "TESTEvnt.Dll" Alias "DoKeys" (lpStr$)
Declare Sub DoKeysHwnd Lib "TESTEvnt.Dll" Alias "DoKeyshWnd" (hWnd%, lpStr$)

' Useful function when working with the Windows API,
' to extract the HI/LO wordt from a Long Integer.
'---------------------------------------------------
Declare Function HIWORD(LongVar&) As Integer
Function HIWORD (LongVar&) Static As Integer
    HIWORD = LongVar& / 65536
End Function

Declare Function LOWORD(LongVar&) As Integer
Function LOWORD (LongVar&) Static As Integer
    LOWORD = LongVar& And &H0000FFFF
End Function

' Useful function when working with the Windows API,
' to extract the HI/LO byte from am Integer.
'---------------------------------------------------
Declare Function HIBYTE(IntVar%) As Integer
Function HIBYTE (IntVar%) Static As Integer
    HIBYTE = IntVar% / 256
End Function

Declare Function LOBYTE(IntVar%) As Integer
Function LOBYTE (IntVar%) Static As Integer
    LOBYTE = IntVar% And &H00FF
End Function

'                                                       *********************
'$ENDIF MSTEST_INCLUDED
'                                                       *********************

'----------------------------------------------------------------------------
'  DEFINE's that control the inclusion of the remainder of MSTEST.INC
'----------------------------------------------------------------------------
'$IFDEF MSTEST
    '$DEFINE TESTCTRL
    '$DEFINE TESTSCRN
    '$DEFINE TESTDLGS
    '$DEFINE TESTEVNT
    '$DEFINE TESTUI
'$ENDIF

'$IFDEF TESTCTRL
    '$DEFINE W_MISC
    '$DEFINE W_WINDOW
    '$DEFINE W_MENU
    '$DEFINE W_ERROR
    '$DEFINE W_CONTROL
'$ENDIF

'$IFDEF W_ERROR_TRAP
    '$DEFINE W_ERROR
'$ENDIF

'$IFDEF W_CONTROL
    '$DEFINE W_BUTTON
    '$DEFINE W_CHECK
    '$DEFINE W_OPTION
    '$DEFINE W_EDIT
    '$DEFINE W_LIST
    '$DEFINE W_COMBO
'$ENDIF

'$IFDEF TESTSCRN
    '$DEFINE TESTSCRN_DECL
    '$DEFINE TESTSCRN_ERRS
'$ENDIF

'$IFDEF TESTDLGS
    '$DEFINE TESTDLGS_DECL
    '$DEFINE TESTDLGS_ERRS
'$ENDIF

'$IFDEF  W_BUTTON OR W_CHECK OR W_OPTION OR W_EDIT OR W_LIST OR W_COMBO
    '$DEFINE W_A_CONTROL
'$ENDIF

'                                                       *********************
'$IFDEF TESTUI AND NOT TESTUI_INCLUDED AND NOT NT
'                                                       *********************
'----------------------------------------------------------------------------
' TESTUI.dll:
'   Function declarations for use with TESTUI
'----------------------------------------------------------------------------
Declare Function DlgBox         Lib "TESTUI.dll" Alias "DlgBox"         (DlgId%,  hwndOwner%, proc As CallBack, ResFile$) As Integer
Declare Function DlgBox3D       Lib "TESTUI.dll" Alias "DlgBox3D"       (DlgId%,  hwndOwner%, proc As CallBack, ResFile$) As Integer
Declare Function SetScriptMenu  Lib "TESTUI.dll" Alias "SetScriptMenu"  (MenuId%, hwnd%, ResFile$) As Integer
Declare Function SetIconBar     Lib "TESTUI.dll" Alias "SetIconBar"     (IconBarId%, proc As Callback, AppName$, ResFile$, fAlwaysOnTop%) As Integer
Declare Function SetSysMenu     Lib "TESTUI.dll" Alias "SetSysMenu"     (MenuId%, proc As Callback, AppName$, ResFile$) As Integer
Declare Function SetSysMenu3D   Lib "TESTUI.dll" Alias "SetSysMenu3D"   (MenuId%, proc As Callback, AppName$, ResFile$) As Integer
Declare Function MSTLoadIcon    Lib "TESTUI.dll" Alias "MSTLoadIcon"    (IconId%, ResFile$) As Integer
Declare Sub      MSTDestroyIcon Lib "TESTUI.dll" Alias "MSTDestroyIcon" (hIcon%)

'                                                       *********************
'$DEFINE TESTUI_INCLUDED
'$ENDIF
'$IFDEF W_MISC AND NOT W_MISC_INCLUDED
'                                                       *********************


'----------------------------------------------------------------------------
' W_MISC:  Miscellanious Routines, types and Constants.
'----------------------------------------------------------------------------
Const MAX_CAPTION = 128

Type INFO
    hWnd            As Integer
    hWndParent      As Integer
    szClass         As String * MAX_CAPTION
    szCaption       As String * MAX_CAPTION
    szParentClass   As String * MAX_CAPTION
    szParentCaption As String * MAX_CAPTION
    szModuleName    As String * MAX_CAPTION
    lStyle          As Long
    fChild          As Integer
    wID             As Integer
    wLeft           As Integer
    wTop            As Integer
    wRight          As Integer
    wBottom         As Integer
    wWidth          As Integer
    wHeight         As Integer
End Type

' The 4 WMessage[W|L] API are slight variations on the windows
' SendMessage() API.  Two things are provided:
'
'   Validation of hWnd%: - If invalid an error value that
'                          is trappable by WErrorTrap is
'                        - If hWnd is NULL, the message goes
'                          to the ActiveWindow.
'   Only need paramaters: Pass in only the paramaters that are needed:
'       WMessage:   Wp and Lp are set to zero
'       WMessageW:  Lp is set to zero
'       WMessageL:  Wp is set to zero
'       WMessageWL: just like SendMessage() but with hWnd validation
'---------------------------------------------------------------------
Declare Function WMessage       Lib "TESTCtrl.dll" Alias "WMessage"       (hWnd%, wMsg%)
Declare Function WMessageW      Lib "TESTCtrl.dll" Alias "WMessageW"      (hWnd%, wMsg%, wp%)
Declare Function WMessageL      Lib "TESTCtrl.dll" Alias "WMessageL"      (hWnd%, wMsg%, lp As Any)
Declare Function WMessageWL     Lib "TESTCtrl.dll" Alias "WMessageWL"     (hWnd%, wMsg%, wp%, lp As Any)
Declare Function WIsVisible     Lib "TESTCtrl.dll" Alias "WIsVisible"     (hWnd%) As Integer
Declare Function WTextLen       Lib "TESTCtrl.dll" Alias "WTextLen"       (hWnd%) As Long
Declare Sub      WGetText       Lib "TESTCtrl.dll" Alias "WGetText"       (hWnd%, lpszBuffer$)
Declare Sub      WSetText       Lib "TESTCtrl.dll" Alias "WSetText"       (hWnd%, lpszText$)
Declare Function WNumAltKeys    Lib "TESTCtrl.dll" Alias "WNumAltKeys"    () As Integer
Declare Sub      WGetAltKeys    Lib "TESTCtrl.dll" Alias "WGetAltKeys"    (lpszBuff$)
Declare Function WNumDupAltKeys Lib "TESTCtrl.dll" Alias "WNumDupAltKeys" () As Integer
Declare Sub      WGetDupAltKeys Lib "TESTCtrl.dll" Alias "WGetDupAltKeys" (lpszBuff$)
Declare Sub      WDisplayInfo   Lib "TESTCtrl.dll" Alias "WDisplayInfo"   (hWnd%, wDisplay%)
Declare Sub      WGetInfo       Lib "TESTCtrl.dll" Alias "WGetInfo"       (hWnd%, lpInfo As INFO)

' Layered routines to simulate string functions for the coresponding
' TESTCtrl API
'----------------------------------------------------------------------------
Declare Function GetText       (hWnd%) As String
Declare Function GetAltKeys    () As String
Declare Function GetDupAltKeys () As String

Const DI_DIALOG  = 1
Const DI_DEBUG   = 2
Const DI_BOTH    = 3

'----------------------------------------------------------------------------
' GetText: Layered routine for WGetText()
'----------------------------------------------------------------------------
Function GetText(hWnd%) Static As String
Dim lpszBuffer As String
Dim textLength As Long
    GetText = ""
    textLength = WTextLen(hWnd%)
    If textLength > 0 Then
        lpszBuffer = String$(textLength+1, " ")
        WGetText hWnd%, lpszBuffer
        GetText = lpszBuffer
    End If
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' GetAltKeys: Layered routine for WGetAltKeys()
'----------------------------------------------------------------------------
Function GetAltKeys() Static As String
Dim lpszBuffer As String
    lpszBuffer = String$(WNumAltKeys()+1, " ")
    WGetAltKeys lpszBuffer
    GetAltKeys = lpszBuffer
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' GetDupAltKeys: Layered routine for WGetDupAltKeys()
'----------------------------------------------------------------------------
Function GetDupAltKeys() Static As String
Dim lpszBuffer As String
    lpszBuffer = String$(WNumDupAltKeys()+1, " ")
    WGetDupAltKeys lpszBuffer
    GetDupAltKeys = lpszBuffer
    lpszBuffer = ""
End Function

'                                                       *********************
'$DEFINE W_MISC_INCLUDED
'$ENDIF
'$IFDEF TESTEVNT AND NOT TESTEVNT_INCLUDED
'                                                       *********************

'----------------------------------------------------------------------------
' TESTEvnt.Dll:
'   Function declarations for use with TESTEvnt
'----------------------------------------------------------------------------
'$IFNDEF NT

TYPE  MEMORYINFO
    LargestAvail        AS LONG     ' Largest available free block in bytes
    MaxPagesUnlock      AS LONG     ' Maximum unlocked page allocation in pages
    MaxPagesLocked      AS LONG     ' Maximum locked page allocation in pages
    TotalLinBytes       AS LONG     ' Linear address space size in bytes
    TotalUnlockBytes    AS LONG     ' Total number of unlocked bytes
    TotalFreePhysBytes  AS LONG     ' Total number of free physical bytes
    TotalPhysBytes      AS LONG     ' Total number of physical bytes
    FreeLinBytes        AS LONG     ' Free linear address space in bytes
    SwapFileSize        AS LONG     ' Size of paging file/partition in bytes
    Reserved1           AS LONG     ' reserved for future expansion, all bits set
    Reserved2           AS LONG     ' reserved for future expansion, all bits set
    Reserved3           AS LONG     ' reserved for future expansion, all bits set
    Reserved4           AS LONG     ' reserved for future expansion, all bits set
    NumSelectors        AS INTEGER  ' Total number of selectors on current LDT
    NumFreeSelectors    AS INTEGER  ' Number of free selectors on current LDT
    GlobalHeapFree      AS LONG     ' Number of free Global bytes
    USERHeapFree        AS LONG     ' Number of free bytes in USER.EXE's heap
    GDIHeapFree         AS LONG     ' Number of free bytes in GDI.EXE's heap
    SysResFree          AS INTEGER  ' *PERCENTAGE* of free system resources
END TYPE

Declare Sub      WaitUntilIdle        Lib "TESTEVNT.DLL" Alias "WaitUntilIdle"        ()
Declare Function GetMemoryInfo        Lib "TESTEvnt.Dll" Alias "GetMemoryInfo"        (lpMemInfo As MEMORYINFO) As Integer
Declare Function VMGetScreenCols      Lib "TESTEvnt.Dll" Alias "VMGetScreenCols"      (HWND%) As Integer
Declare Function VMGetCursPos         Lib "TESTEvnt.Dll" Alias "VMGetCursPos"         (HWND%) As Integer
Declare Function VMGetScreen          Lib "TESTEvnt.Dll" Alias "VMGetScreen"          (HWND%, UINT%, UINT%, UINT%, UINT%, LPSTR$) As Integer
Declare Function VMGetScreenClip      Lib "TESTEvnt.Dll" Alias "VMGetScreenClip"      (HWND%, UINT%, UINT%, UINT%, UINT%) As Integer
Declare Sub      VMSetBackground      Lib "TESTEvnt.Dll" Alias "VMSetBackground"      (HWND%, BOOL%)
Declare Function VMPipeOpen           Lib "TESTEvnt.Dll" Alias "VMPipeOpen"           (HWND%, SCRIPTSUB As Callback ) As Integer
Declare Function VMPipeClose          Lib "TESTEvnt.Dll" Alias "VMPipeClose"          (HWND%) As Integer
Declare Function VMPipeGetText        Lib "TESTEvnt.Dll" Alias "VMPipeGetText"        (HWND%, LPSTR$ ) As Integer

CONST PIPESTRINGSIZE        = 129           ' 128 chars + NULL

' **  VMPipeGetText() Return values... **
'----------------------------------------
CONST PGT_FAILED            = &H0000
CONST PGT_COMPLETE          = &H0001
CONST PGT_MOREREADY         = &H0002

'$ENDIF NT 'for TESTEvnt VM Stuff

Declare Sub      QueKeys              Lib "TESTEvnt.Dll" Alias "QueKeys"              (lpStr$)
Declare Sub      QueKeyDn             Lib "TESTEvnt.Dll" Alias "QueKeyDn"             (lpStr$)
Declare Sub      QueKeyUp             Lib "TESTEvnt.Dll" Alias "QueKeyUp"             (lpStr$)
Declare Sub      QueSetSpeed          Lib "TESTEvnt.Dll" Alias "QueSetSpeed"          (ms%)
Declare Sub      QuePause             Lib "TESTEvnt.Dll" Alias "QuePause"             (ms&)
Declare Sub      QueFlush             Lib "TESTEvnt.Dll" Alias "QueFlush"             (fRestoreKeyState%)
Declare Sub      QueEmpty             Lib "TESTEvnt.Dll" Alias "QueEmpty"             ()
Declare Sub      QueMouseMove         Lib "TESTEvnt.Dll" Alias "QueMouseMove"         (x%, y%)
Declare Sub      QueMouseDn           Lib "TESTEvnt.Dll" Alias "QueMouseDn"           (iBtn%, x%, y%)
Declare Sub      QueMouseUp           Lib "TESTEvnt.Dll" Alias "QueMouseUp"           (iBtn%, x%, y%)
Declare Sub      QueMouseClick        Lib "TESTEvnt.Dll" Alias "QueMouseClick"        (iBtn%, x%, y%)
Declare Sub      QueMouseDblClk       Lib "TESTEvnt.Dll" Alias "QueMouseDblClk"       (iBtn%, x%, y%)
Declare Sub      QueMouseDblDn        Lib "TESTEvnt.Dll" Alias "QueMouseDblDn"        (iBtn%, x%, y%)
Declare Sub      QueSetFocus          Lib "TESTEvnt.Dll" Alias "QueSetFocus"          (hwnd%)
Declare Sub      QueSetRelativeWindow Lib "TESTEvnt.Dll" Alias "QueSetRelativeWindow" (hwnd%)

'$ifndef VK_WINAPI
Const VK_LBUTTON = 1
Const VK_RBUTTON = 2
Const VK_MBUTTON = 4
'$define VK_WINAPI
'$endif

'                                                       *********************
'$DEFINE TESTEVNT_INCLUDED
'$ENDIF
'$IFDEF TESTSCRN_DECL AND NOT TESTSCRN_DECL_INCLUDED
'                                                       *********************


'----------------------------------------------------------------------------
' TESTScrn.DLL:
'       Type, Const, and Function declarations for use with TESTScrn
'----------------------------------------------------------------------------
Type wRect
    x1 As Integer
    y1 As Integer
    x2 As Integer
    y2 As Integer
End Type

Const SCRNAPPEND  = 0
Const SCRNREPLACE = 1
Const SCRNINSERT  = 2

'*** TESTSCRN.DLL Routines
'
Declare Function fCompFiles             Lib "TESTScrn.DLL" Alias "fCompFiles"             (lpszFileName1$, Scr1%, lpszFileName2$, Scr2%, CompareType%) As Integer
Declare Function fCompScreenActivate    Lib "TESTScrn.DLL" Alias "fCompScreenActivate"    (lpszFileName$, OpenKeys$, CloseKeys$, lpRect As wRect, Scr1%, Hide%, Flag%) As Integer
Declare Function fCompScreen            Lib "TESTScrn.DLL" Alias "fCompScreen"            (lpszFileName$, lpRect As wRect, Scr1%, Hide%, Flag%) As Integer
Declare Function fCompWindowActivate    Lib "TESTScrn.DLL" Alias "fCompWindowActivate"    (lpszFileName$, OpenKeys$, CloseKeys$, Scr1%, Hide%, Flag%) As Integer
Declare Function fCompWindow            Lib "TESTScrn.DLL" Alias "fCompWindow"            (lpszFileName$, hWnd%, Scr1%, Hide%, Flag%) As Integer
Declare Function fDelScreen             Lib "TESTScrn.DLL" Alias "fDelScreen"             (lpszFileName$, Scr%) As Integer
Declare Function fDumpFileToClip        Lib "TESTScrn.DLL" Alias "fDumpFileToClip"        (lpszFileName$, Scr%) As Integer
Declare Function fDumpScreenActivate    Lib "TESTScrn.DLL" Alias "fDumpScreenActivate"    (lpszFileName$, OpenKeys$, CloseKeys$, lpRect As wRect, Action%, Scr1%, Flag%) As Integer
Declare Function fDumpScreen            Lib "TESTScrn.DLL" Alias "fDumpScreen"            (lpszFileName$, lpRect As wRect, Action%, Scr1%, Flag%) As Integer
Declare Function fDumpSrnToClipActivate Lib "TESTScrn.DLL" Alias "fDumpSrnToClipActivate" (OpenKeys$, CloseKeys$, lpRect As wRect, Hide%) As Integer
Declare Function fDumpSrnToClip         Lib "TESTScrn.DLL" Alias "fDumpSrnToClip"         (lpRect As wRect, Hide%) As Integer
Declare Function fDumpWindowActivate    Lib "TESTScrn.DLL" Alias "fDumpWindowActivate"    (lpszFileName$, OpenKeys$, CloseKeys$, Action%, Scr1%, Flag%) As Integer
Declare Function fDumpWindow            Lib "TESTScrn.DLL" Alias "fDumpWindow"            (lpszFileName$, wHnd%, Action%, Scr1%, Flag%) As Integer
Declare Function fDumpWndToClipActivate Lib "TESTScrn.DLL" Alias "fDumpWndToClipActivate" (OpenKeys$, CloseKeys$, Hide%) As Integer
Declare Function fDumpWndToClip         Lib "TESTScrn.DLL" Alias "fDumpWndToClip"         (hWnd%, Hide%) As Integer
Declare Function fFileInfo              Lib "TESTScrn.DLL" Alias "fFileInfo"              (lpszName$, lpRect AS wRect, VideoMode AS POINTER TO INTEGER, Count AS POINTER TO INTEGER) As Integer
Declare Function fGetDLLVersion         Lib "TESTScrn.DLL" Alias "fGetDLLVersion"         (lpszFileName$) As Integer
Declare Function fGetMaxScreen          Lib "TESTScrn.DLL" Alias "fGetMaxScreen"          (lpszFileName$) As Integer
Declare Function fGetOS                 Lib "TESTScrn.DLL" Alias "fGetOS"                 (lpszFileName$) As Integer
Declare Function fSaveFileToDIB         Lib "TESTScrn.DLL" Alias "fSaveFileToDIB"         (lpszFileName1$, Scr%, lpszFileName2$) As Integer
Declare Function fSaveSrnToDIBActivate  Lib "TESTScrn.DLL" Alias "fSaveSrnToDIBActivate"  (lpszFileName$, OpenKeys$, CloseKeys$, lpRect As wRect, Hide%) As Integer
Declare Function fSaveSrnToDIB          Lib "TESTScrn.DLL" Alias "fSaveSrnToDIB"          (lpszFileName$, lpRect As wRect, Hide%) As Integer
Declare Function fSaveWndToDIBActivate  Lib "TESTScrn.DLL" Alias "fSaveWndToDIBActivate"  (lpszFileName$, OpenKeys$, CloseKeys$, Hide%) As Integer
Declare Function fSaveWndToDIB          Lib "TESTScrn.DLL" Alias "fSaveWndToDIB"          (lpszFileName$, hWnd%, Hide%) As Integer
Declare Function fViewScreen            Lib "TESTScrn.DLL" Alias "fViewScreen"            (lpszFileName$, hWnd%, Scr1%, Action%) As Integer


'                                                       *********************
'$DEFINE TESTSCRN_DECL_INCLUDED
'$ENDIF
'$IFDEF TESTSCRN_ERRS AND NOT TESTSCRN_ERRS_INCLUDED
'                                                       *********************


'*** TESTScrn.DLL Error Codes
'
Const ERR_SCR_NOERROR    = 0
Const ERR_SCR_FILEACCESS = 301
Const ERR_SCR_INVALIDFIL = 302
Const ERR_SCR_INVALSRNID = 303
Const ERR_SCR_INVALSRNMD = 304
Const ERR_SCR_OUTOMEMORY = 305
Const ERR_SCR_READSRNFIL = 306
Const ERR_SCR_RELMEMORY  = 307
Const ERR_SCR_CREATEDDB  = 308
Const ERR_SCR_RWSRNTABLE = 309
Const ERR_SCR_RWCOLTABLE = 310
Const ERR_SCR_WSRNIMAGE  = 311
Const ERR_SCR_WFILEHEAD  = 312
Const ERR_SCR_CREATEDIB  = 313
Const ERR_SCR_SCREENSIZE = 314
Const ERR_SCR_DISPSCREEN = 315
Const ERR_SCR_INVALIDACT = 316
Const ERR_SCR_IMAGEDIFF  = 317
Const ERR_SCR_SRNSIZEDIF = 318
Const ERR_SCR_FILEEXIST  = 319
Const ERR_SCR_CTEMPFILE  = 320
Const ERR_SCR_HIDEWIN    = 321
Const ERR_SCR_INVALWHAND = 322
Const ERR_SCR_OFILEFORM  = 323
Const ERR_SCR_SRNFILEFUL = 324
Const ERR_SCR_INVALSCALE = 325
Const ERR_SCR_OPENCB     = 326
Const ERR_SCR_EMPTYCB    = 327
Const ERR_SCR_COPYTOCB   = 328
Const ERR_SCR_CLOSECB    = 329
Const ERR_SCR_CREATEPAL  = 330
Const ERR_SCR_LIBLOADERR = 331


'                                                       *********************
'$DEFINE TESTSCRN_ERRS_INCLUDED
'$ENDIF
'$IFNDEF NT
'$IFDEF TESTDLGS_DECL AND NOT TESTDLGS_DECL_INCLUDED
'                                                       *********************


'----------------------------------------------------------------------------
' TESTDlgs.DLL:
'       Type, Const, and Function declarations for use with TESTDlgs
'----------------------------------------------------------------------------
Const cchCLASSMAC = 32
Const cchTEXTMAC  = 256
Const wVEREB      = 1

Type DCR
    xLeft  As Integer
    yMin   As Integer
    xRight As Integer
    yLast  As Integer
End Type

Declare Function AwaitSaveCompletion Lib "TESTDlgs.DLL" Alias "AwaitSaveCompletion" () As Integer
Declare Function ComparisonResults   Lib "TESTDlgs.DLL" Alias "ComparisonResults"   () As Integer
Declare Function CmpWindow           Lib "TESTDlgs.DLL" Alias "CmpWindow"           (hWnd%, nDialog%, fIncludeParent%) As Integer
Declare Function CmpWindowActivate   Lib "TESTDlgs.DLL" Alias "CmpWindowActivate"   (lpszOpenKeys$, lpszCloseKey$, nDialog%, fIncludeParent%) As Integer
Declare Function CmpWindowCaption    Lib "TESTDlgs.DLL" Alias "CmpWindowCaption"    (lpszCap$, nDialog%, fIncludeParent%) As Integer
Declare Function CmpWindowDelayed    Lib "TESTDlgs.DLL" Alias "CmpWindowDelayed"    (nDelay%, nDialog%, fIncludeParent%, lpszCloseKeys$) As Integer
Declare Function FindWindowCaption   Lib "TESTDlgs.DLL" Alias "FindWindowCaption"   (lpszCap$, hWndStart%) As Integer
Declare Function SaveMenu            Lib "TESTDlgs.DLL" Alias "SaveMenu"            (hWnd%, nDialog%, lpszDesc$, fReplace%) As Integer
Declare Function SaveMenuActivate    Lib "TESTDlgs.DLL" Alias "SaveMenuActivate"    (lpszOpenKeys$, lpszCloseKeys$, nDialog%, lpszDesc$, fReplace%) As Integer
Declare Function SaveMenuCaption     Lib "TESTDlgs.DLL" Alias "SaveMenuCaption"     (lpszCap$, nDialog%, lpszDesc$, fReplace%) As Integer
Declare Function SaveMenuDelayed     Lib "TESTDlgs.DLL" Alias "SaveMenuDelayed"     (nDelay%, nDialog%, lpszDesc$, fReplace%, CloseKeys$) As Integer
Declare Function SaveWindow          Lib "TESTDlgs.DLL" Alias "SaveWindow"          (hWnd%, nDialog%, lpszDesc$, fReplace%, fIncludeParent%) As Integer
Declare Function SaveWindowActivate  Lib "TESTDlgs.DLL" Alias "SaveWindowActivate"  (lpszOpenKeys$, lpszCloseKeys$, nDialog%, lpszDesc$, fReplace%, fIncludeParent%) As Integer
Declare Function SaveWindowCaption   Lib "TESTDlgs.DLL" Alias "SaveWindowCaption"   (lpszCap$, nDialog%, lpszDesc$, fReplace%, fIncludeParent%) As Integer
Declare Function SaveWindowDelayed   Lib "TESTDlgs.DLL" Alias "SaveWindowDelayed"   (nDelay%, nDialog%, lpszDesc$, fReplace%, fIncludeParent%, lpszCloseKeys$) As Integer
Declare Function SetDialogFile       Lib "TESTDlgs.DLL" Alias "SetDialogFile"       (lpszDialogName$) As Integer
Declare Function SetLogFile          Lib "TESTDlgs.DLL" Alias "SetLogFile"          (lpszLogName$) As Integer


'                                                       *********************
'$DEFINE TESTDLGS_DECL_INCLUDED
'$ENDIF
'$IFDEF TESTDLGS_ERRS AND NOT TESTDLGS_ERRS_INCLUDED
'                                                       *********************


'*** Function return codes
'
Const ERR_DLGS_NOERR          =   0
Const ERR_DLGS_FUZZY          =  -1
Const ERR_DLGS_EXCESS         =  -2
Const ERR_DLGS_CTLNOTFOUND    =  -3
Const ERR_DLGS_NODLGFILE      = -10
Const ERR_DLGS_FILENOTFOUND   = -11
Const ERR_DLGS_BADWDLFILE     = -12
Const ERR_DLGS_LIBLOADERR     = -13
Const ERR_DLGS_SAVEERR        = -14
Const ERR_DLGS_DLGFILEERR     = -15
Const ERR_DLGS_TMPFILEERR     = -16
Const ERR_DLGS_VERSIONERR     = -17
Const ERR_DLGS_DLGFILEFULL    = -18
Const ERR_DLGS_OUTOFMEMORY    = -20
Const ERR_DLGS_BUFFERERR      = -21
Const ERR_DLGS_NOTIMER        = -22
Const ERR_DLGS_NODYNDIALOG    = -30
Const ERR_DLGS_INVALIDHWND    = -31
Const ERR_DLGS_BADCAPTION     = -32
Const ERR_DLGS_BADDLGNUM      = -33
Const ERR_DLGS_BADCTLINDEX    = -34
Const ERR_DLGS_BADCTLTYPE     = -35
Const ERR_DLGS_BADSAVEACTION  = -36
Const ERR_DLGS_APPSPECIFIC    = -37


'                                                       *********************
'$DEFINE TESTDLGS_ERRS_INCLUDED
'$ENDIF
'$ENDIF NT for TESTDLGS
'$IFDEF W_WINDOW AND NOT W_WINDOW_INCLUDED
'                                                       *********************


'----------------------------------------------------------------------------
' TESTCtrl.dll routines, types, & constants
'----------------------------------------------------------------------------

'*** Window size and position types
'
Type WNDPOS
    wLeft   As Integer
    wTop    As Integer
End Type

Type WNDSIZ
    wWidth  As Integer
    wHeight As Integer
End Type

Type WNDPOSSIZ
    wLeft   As Integer
    wTop    As Integer
    wWidth  As Integer
    wHeight As Integer
End Type

'*** Window Positioning and Sizing routines & contants
'
Declare Sub      WMinWnd       Lib "TESTCtrl.dll" Alias "WMinWnd"       (hWnd%)
Declare Sub      WMaxWnd       Lib "TESTCtrl.dll" Alias "WMaxWnd"       (hWnd%)
Declare Sub      WResWnd       Lib "TESTCtrl.dll" Alias "WResWnd"       (hWnd%)
Declare Sub      WSetWndPos    Lib "TESTCtrl.dll" Alias "WSetWndPos"    (hWnd%, wLeft%, wTop%)
Declare Sub      WSetWndSiz    Lib "TESTCtrl.dll" Alias "WSetWndSiz"    (hWnd%, wWidth%, wHeight%)
Declare Sub      WSetWndPosSiz Lib "TESTCtrl.dll" Alias "WSetWndPosSiz" (hWnd%, wLeft%, wTop%, wWidth%, wHeight%)
Declare Sub      WAdjWndPos    Lib "TESTCtrl.dll" Alias "WAdjWndPos"    (hWnd%, deltaLeft%,  deltaTop%)
Declare Sub      WAdjWndSiz    Lib "TESTCtrl.dll" Alias "WAdjWndSiz"    (hWnd%, deltaWidth%, deltaHeight%)
Declare Sub      WAdjWndPosSiz Lib "TESTCtrl.dll" Alias "WAdjWndPosSiz" (hWnd%, deltaLeft%,  deltaTop%, deltaWidth%, deltaHeight%)
Declare Sub      WGetWndPos    Lib "TESTCtrl.dll" Alias "WGetWndPos"    (hWnd%, lpWndPos    As WNDPOS,    fRelative%)
Declare Sub      WGetWndSiz    Lib "TESTCtrl.dll" Alias "WGetWndSiz"    (hWnd%, lpWndSiz    As WNDSIZ)
Declare Sub      WGetWndPosSiz Lib "TESTCtrl.dll" Alias "WGetWndPosSiz" (hWnd%, lpWndPosSiz As WNDPOSSIZ, fRelative%)
Declare Function WIsMaximized  Lib "TESTCtrl.dll" Alias "WIsMaximized"  (hWnd%) As Integer
Declare Function WIsMinimized  Lib "TESTCtrl.dll" Alias "WIsMinimized"  (hWnd%) As Integer


Const W_RELATIVE = TRUE
Const W_ABSOLUTE = FALSE


'                                                       *********************
'$DEFINE W_WINDOW_INCLUDED
'$ENDIF
'$IFDEF W_MENU AND NOT W_MENU_INCLUDED
'                                                       *********************


'*** Menu routines & constants
'
Declare Sub      WSysMenu           Lib "TESTCtrl.dll" Alias "WSysMenu"           (hWnd%)
Declare Function WSysMenuExists     Lib "TESTCtrl.dll" Alias "WSysMenuExists"     (hWnd%) As Integer
Declare Sub      WMenu              Lib "TESTCtrl.dll" Alias "WMenu"              (lpszName$)
Declare Sub      WMenuEx      CDECL Lib "TESTCtrl.dll" Alias "WMenuEx"            (lpszName$, ...)
Declare Function WMenuExists        Lib "TESTCtrl.dll" Alias "WMenuExists"        (lpszName$) As Integer
Declare Function WMenuGrayed        Lib "TESTCtrl.dll" Alias "WMenuGrayed"        (lpszName$) As Integer
Declare Function WMenuChecked       Lib "TESTCtrl.dll" Alias "WMenuChecked"       (lpszName$) As Integer
Declare Function WMenuEnabled       Lib "TESTCtrl.dll" Alias "WMenuEnabled"       (lpszName$) As Integer
Declare Function WMenuCount         Lib "TESTCtrl.dll" Alias "WMenuCount"         () As Integer
Declare Sub      WMenuText          Lib "TESTCtrl.dll" Alias "WMenuText"          (lpszName$, lpszBuffer$)
Declare Function WMenuLen           Lib "TESTCtrl.dll" Alias "WMenuLen"           (lpszName$) As Integer
Declare Sub      WMenuFullText      Lib "TESTCtrl.dll" Alias "WMenuFullText"      (lpszName$, lpszBuffer$)
Declare Function WMenuFullLen       Lib "TESTCtrl.dll" Alias "WMenuFullLen"       (lpszName$) As Integer
Declare Sub      WMenuEnd           Lib "TESTCtrl.dll" Alias "WMenuEnd"           ()
Declare Function WMenuNumAltKeys    Lib "TESTCtrl.dll" Alias "WMenuNumAltKeys"    () As Integer
Declare Sub      WMenuGetAltKeys    Lib "TESTCtrl.dll" Alias "WMenuGetAltKeys"    (lpszBuff$)
Declare Function WMenuNumDupAltKeys Lib "TESTCtrl.dll" Alias "WMenuNumDupAltKeys" () As Integer
Declare Sub      WMenuGetDupAltKeys Lib "TESTCtrl.dll" Alias "WMenuGetDupAltKeys" (lpszBuff$)

' Layered routines to simulate string functions for the coresponding
' TESTCtrl API
'----------------------------------------------------------------------------
Declare Function MenuText          (lpszName$) As String
Declare Function MenuFullText      (lpszName$) As String
Declare Function MenuGetAltKeys    () As String
Declare Function MenuGetDupAltKeys () As String

' Unlike the rest of the menu routines, WMenuSeparator() does not ignore
' menu separators when specifing indexes.  The first menu item is item #1
' the second #2, and so on including all separators.
'------------------------------------------------------------------------
Declare Function WMenuSeparator Lib "TESTCtrl.dll" Alias "WMenuSeparator" (sIndex%) As Integer

' Obsolete Menu API
'------------------
Declare Sub      WMenuX         Lib "TESTCtrl.dll" Alias "WMenuX"        (iIndex%)
Declare Function WMenuGrayedX   Lib "TESTCtrl.dll" Alias "WMenuGrayedX"  (iIndex%) As Integer
Declare Function WMenuCheckedX  Lib "TESTCtrl.dll" Alias "WMenuCheckedX" (iIndex%) As Integer
Declare Function WMenuEnabledX  Lib "TESTCtrl.dll" Alias "WMenuEnabledX" (iIndex%) As Integer


'----------------------------------------------------------------------------
' MenuText: Layered routine for WMenuText()
'----------------------------------------------------------------------------
Function MenuText(lpszName$) Static As String
Dim lpszBuffer As String
Dim menuLength As Integer
    MenuText = ""
    menuLength = WMenuLen(lpszName$)
    If menuLength >= 0 Then
        lpszBuffer = String$(menuLength+1, " ")
        WMenuText lpszName$, lpszBuffer
        MenuText = lpszBuffer
    End if
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' MenuFullText: Layered routine for WMenuFullText()
'----------------------------------------------------------------------------
Function MenuFullText(lpszName$) Static As String
Dim lpszBuffer As String
Dim menuLength As Integer
    MenuFullText = ""
    menuLength = WMenuFullLen(lpszName$)
    If menuLength >= 0 Then
        lpszBuffer = String$(menuLength+1, " ")
        WMenuFullText lpszName$, lpszBuffer
        MenuFullText = lpszBuffer
    End If
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' MenuGetAltKeys: Layered routine for WMenuGetAltKeys()
'----------------------------------------------------------------------------
Function MenuGetAltKeys() Static As String
Dim lpszBuffer As String
    lpszBuffer = String$(WMenuNumAltKeys()+1, " ")
    WMenuGetAltKeys lpszBuffer
    MenuGetAltKeys = lpszBuffer
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' MenuGetDupAltKeys: Layered routine for WMenuGetDupAltKeys()
'----------------------------------------------------------------------------
Function MenuGetDupAltKeys() Static As String
Dim lpszBuffer As String
    lpszBuffer = String$(WMenuNumDupAltKeys()+1, " ")
    WMenuGetDupAltKeys lpszBuffer
    MenuGetDupAltKeys = lpszBuffer
    lpszBuffer = ""
End Function

'                                                       *********************
'$DEFINE W_MENU_INCLUDED
'$ENDIF
'$IFDEF W_A_CONTROL AND NOT W_A_CONTROL_INCLUDED
'                                                       *********************


'*** Global routine & constants used by all controls
'
Declare Sub WStaticSetClass Lib "TESTCtrl.dll" Alias "WStaticSetClass" (lpszClassName$)
Declare Sub WResetClasses   Lib "TESTCtrl.dll" Alias "WResetClasses"   ()


'                                                       *********************
'$DEFINE W_A_CONTROL_INCLUDED
'$ENDIF
'$IFDEF W_BUTTON AND NOT W_BUTTON_INCLUDED
'                                                       *********************


'*** Button routines
'
Declare Sub      WButtonSetClass Lib "TESTCtrl.dll" Alias "WButtonSetClass" (lpszClassName$)
Declare Function WButtonExists   Lib "TESTCtrl.dll" Alias "WButtonExists"   (lpszName$) As Integer
Declare Function WButtonEnabled  Lib "TESTCtrl.dll" Alias "WButtonEnabled"  (lpszName$) As Integer
Declare Function WButtonFocus    Lib "TESTCtrl.dll" Alias "WButtonFocus"    (lpszName$) As Integer
Declare Sub      WButtonClick    Lib "TESTCtrl.dll" Alias "WButtonClick"    (lpszName$)
Declare Sub      WButtonHide     Lib "TESTCtrl.dll" Alias "WButtonHide"     (lpszName$)
Declare Sub      WButtonShow     Lib "TESTCtrl.dll" Alias "WButtonShow"     (lpszName$)
Declare Sub      WButtonEnable   Lib "TESTCtrl.dll" Alias "WButtonEnable"   (lpszName$)
Declare Sub      WButtonDisable  Lib "TESTCtrl.dll" Alias "WButtonDisable"  (lpszName$)
Declare Function WButtonDefault  Lib "TESTCtrl.dll" Alias "WButtonDefault"  (lpszName$) As Integer
Declare Function WButtonDefaults Lib "TESTCtrl.dll" Alias "WButtonDefaults" () As Integer
Declare Sub      WButtonSetFocus Lib "TESTCtrl.dll" Alias "WButtonSetFocus" (lpszName$)

'                                                       *********************
'$DEFINE W_BUTTON_INCLUDED
'$ENDIF
'$IFDEF W_CHECK AND NOT W_CHECK_INCLUDED
'                                                       *********************


' CheckBox routines
'
Declare Sub      WCheckSetClass Lib "TESTCtrl.dll" Alias "WCheckSetClass" (lpszClassName$)
Declare Function WCheckExists   Lib "TESTCtrl.dll" Alias "WCheckExists"   (lpszName$) As Integer
Declare Function WCheckEnabled  Lib "TESTCtrl.dll" Alias "WCheckEnabled"  (lpszName$) As Integer
Declare Function WCheckFocus    Lib "TESTCtrl.dll" Alias "WCheckFocus"    (lpszName$) As Integer
Declare Function WCheckState    Lib "TESTCtrl.dll" Alias "WCheckState"    (lpszName$) As Integer
Declare Sub      WCheckClick    Lib "TESTCtrl.dll" Alias "WCheckClick"    (lpszName$)
Declare Sub      WCheckHide     Lib "TESTCtrl.dll" Alias "WCheckHide"     (lpszName$)
Declare Sub      WCheckShow     Lib "TESTCtrl.dll" Alias "WCheckShow"     (lpszName$)
Declare Sub      WCheckEnable   Lib "TESTCtrl.dll" Alias "WCheckEnable"   (lpszName$)
Declare Sub      WCheckDisable  Lib "TESTCtrl.dll" Alias "WCheckDisable"  (lpszName$)
Declare Sub      WCheckCheck    Lib "TESTCtrl.dll" Alias "WCheckCheck"    (lpszName$)
Declare Sub      WCheckUnCheck  Lib "TESTCtrl.dll" Alias "WCheckUnCheck"  (lpszName$)
Declare Sub      WCheckSetFocus Lib "TESTCtrl.dll" Alias "WCheckSetFocus" (lpszName$)

Const UNCHECKED = 0
Const CHECKED   = 1
Const GRAYED    = 2


'                                                       *********************
'$DEFINE W_CHECK_INCLUDED
'$ENDIF
'$IFDEF W_OPTION AND NOT W_OPTION_INCLUDED
'                                                       *********************


'*** Option Button routines
'
Declare Sub      WOptionSetClass Lib "TESTCtrl.dll" Alias "WOptionSetClass" (lpszClassName$)
Declare Function WOptionExists   Lib "TESTCtrl.dll" Alias "WOptionExists"   (lpszName$) As Integer
Declare Function WOptionEnabled  Lib "TESTCtrl.dll" Alias "WOptionEnabled"  (lpszName$) As Integer
Declare Function WOptionFocus    Lib "TESTCtrl.dll" Alias "WOptionFocus"    (lpszName$) As Integer
Declare Function WOptionState    Lib "TESTCtrl.dll" Alias "WOptionState"    (lpszName$) As Integer
Declare Sub      WOptionClick    Lib "TESTCtrl.dll" Alias "WOptionClick"    (lpszName$)
Declare Sub      WOptionHide     Lib "TESTCtrl.dll" Alias "WOptionHide"     (lpszName$)
Declare Sub      WOptionShow     Lib "TESTCtrl.dll" Alias "WOptionShow"     (lpszName$)
Declare Sub      WOptionEnable   Lib "TESTCtrl.dll" Alias "WOptionEnable"   (lpszName$)
Declare Sub      WOptionDisable  Lib "TESTCtrl.dll" Alias "WOptionDisable"  (lpszName$)
Declare Sub      WOptionSelect   Lib "TESTCtrl.dll" Alias "WOptionSelect"   (lpszName$)
Declare Sub      WOptionSetFocus Lib "TESTCtrl.dll" Alias "WOptionSetFocus" (lpszName$)

'                                                       *********************
'$DEFINE W_OPTION_INCLUDED
'$ENDIF
'$IFDEF W_LIST AND NOT W_LIST_INCLUDED
'                                                       *********************


'*** Listbox routines
'
Declare Sub      WListSetClass     Lib "TESTCtrl.dll" Alias "WListSetClass"     (lpszClass$)
Declare Function WListExists       Lib "TESTCtrl.dll" Alias "WListExists"       (lpszName$) As Integer
Declare Function WListCount        Lib "TESTCtrl.dll" Alias "WListCount"        (lpszName$) As Integer
Declare Sub      WListText         Lib "TESTCtrl.dll" Alias "WListText"         (lpszName$, lpszBuffer$)
Declare Function WListLen          Lib "TESTCtrl.dll" Alias "WListLen"          (lpszName$) As Integer
Declare Function WListIndex        Lib "TESTCtrl.dll" Alias "WListIndex"        (lpszName$) As Integer
Declare Function WListTopIndex     Lib "TESTCtrl.dll" Alias "WListTopIndex"     (lpszName$) As Integer
Declare Sub      WListItemText     Lib "TESTCtrl.dll" Alias "WListItemText"     (lpszName$, iItem%, lpszBuffer$)
Declare Function WListItemLen      Lib "TESTCtrl.dll" Alias "WListItemLen"      (lpszName$, iItem%) As Integer
Declare Function WListItemExists   Lib "TESTCtrl.dll" Alias "WListItemExists"   (lpszName$, lpszItem$) As Integer
Declare Sub      WListItemClk      Lib "TESTCtrl.dll" Alias "WListItemClk"      (lpszName$, iItem%)
Declare Sub      WListItemCtrlClk  Lib "TESTCtrl.dll" Alias "WListItemCtrlClk"  (lpszName$, iItem%)
Declare Sub      WListItemShftClk  Lib "TESTCtrl.dll" Alias "WListItemShftClk"  (lpszName$, iItem%)
Declare Sub      WListItemDblClk   Lib "TESTCtrl.dll" Alias "WListItemDblClk"   (lpszName$, iItem%)
Declare Sub      WListItemClkT     Lib "TESTCtrl.dll" Alias "WListItemClkT"     (lpszName$, lpszItem$)
Declare Sub      WListItemCtrlClkT Lib "TESTCtrl.dll" Alias "WListItemCtrlClkT" (lpszName$, lpszItem$)
Declare Sub      WListItemShftClkT Lib "TESTCtrl.dll" Alias "WListItemShftClkT" (lpszName$, lpszItem$)
Declare Sub      WListItemDblClkT  Lib "TESTCtrl.dll" Alias "WListItemDblClkT"  (lpszName$, lpszItem$)
Declare Function WListSelCount     Lib "TESTCtrl.dll" Alias "WListSelCount"     (lpszName$) As Integer
Declare Sub      WListSelItems     Lib "TESTCtrl.dll" Alias "WListSelItems"     (lpszName$, lpIntArray As Pointer To Integer)
Declare Sub      WListClear        Lib "TESTCtrl.dll" Alias "WListClear"        (lpszName$)
Declare Sub      WListAddItem      Lib "TESTCtrl.dll" Alias "WListAddItem"      (lpszName$, lpszItem$)
Declare Sub      WListDelItem      Lib "TESTCtrl.dll" Alias "WListDelItem"      (lpszName$, iItem%)
Declare Sub      WListDelItemT     Lib "TESTCtrl.dll" Alias "WListDelItemT"     (lpszName$, lpszItem$)
Declare Function WListEnabled      Lib "TESTCtrl.dll" Alias "WListEnabled"      (lpszName$) As Integer
Declare Sub      WListSetFocus     Lib "TESTCtrl.dll" Alias "WListSetFocus"     (lpszName$)

' Layered routines to simulate string functions for the coresponding
' TESTCtrl API
'----------------------------------------------------------------------------
Declare Function ListText     (lpszName$) As String
Declare Function ListItemText (lpszName$, iItem%) As String

'----------------------------------------------------------------------------
' ListText: Layered routine for WListText()
'----------------------------------------------------------------------------
Function ListText(lpszName$) Static As String
Dim lpszBuffer As String
Dim itemLength As Integer
    ListText = ""
    itemLength = WListLen(lpszName)
    If itemLength >= 0 Then
        lpszBuffer = String$(itemLength+1, " ")
        WListText lpszName, lpszBuffer
        ListText = lpszBuffer
    End If
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' ListItemText: Layered routine for WListItemText()
'----------------------------------------------------------------------------
Function ListItemText(lpszName$, sItem%) Static As String
Dim lpszBuffer As String
Dim itemLength As Integer
    ListItemText = ""
    itemLength = WListItemLen(lpszName, sItem)
    If itemLength >= 0 Then
        lpszBuffer = String$(itemLength+1, " ")
        WListItemText lpszName, sItem, lpszBuffer
        ListItemText = lpszBuffer
    End If
    lpszBuffer = ""
End Function


'                                                       *********************
'$DEFINE W_LIST_INCLUDED
'$ENDIF
'$IFDEF W_COMBO AND NOT W_COMBO_INCLUDED
'                                                       *********************


'*** Combobox routines
'
Declare Sub      WComboSetClass    Lib "TESTCtrl.dll" Alias "WComboSetClass"    (lpszClass$)
Declare Sub      WComboSetLBClass  Lib "TESTCtrl.dll" Alias "WComboSetLBClass"  (lpszClass$)
Declare Function WComboExists      Lib "TESTCtrl.dll" Alias "WComboExists"      (lpszName$) As Integer
Declare Function WComboCount       Lib "TESTCtrl.dll" Alias "WComboCount"       (lpszName$) As Integer
Declare Sub      WComboSetText     Lib "TESTCtrl.dll" Alias "WComboSetText"     (lpszName$, lpszText$)
Declare Sub      WComboText        Lib "TESTCtrl.dll" Alias "WComboText"        (lpszName$, lpszBuffer$)
Declare Function WComboLen         Lib "TESTCtrl.dll" Alias "WComboLen"         (lpszName$) As Integer
Declare Sub      WComboSelText     Lib "TESTCtrl.dll" Alias "WComboSelText"     (lpszName$, lpszBuffer$)
Declare Function WComboSelLen      Lib "TESTCtrl.dll" Alias "WComboSelLen"      (lpszName$) As Integer
Declare Function WComboIndex       Lib "TESTCtrl.dll" Alias "WComboIndex"       (lpszName$) As Integer
Declare Sub      WComboItemText    Lib "TESTCtrl.dll" Alias "WComboItemText"    (lpszName$, iItem%, lpszBuffer$)
Declare Function WComboItemLen     Lib "TESTCtrl.dll" Alias "WComboItemLen"     (lpszName$, iItem%) As Integer
Declare Function WComboItemExists  Lib "TESTCtrl.dll" Alias "WComboItemExists"  (lpszName$, lpszItem$) As Integer
Declare Sub      WComboItemClk     Lib "TESTCtrl.dll" Alias "WComboItemClk"     (lpszName$, iItem%)
Declare Sub      WComboItemDblClk  Lib "TESTCtrl.dll" Alias "WComboItemDblClk"  (lpszName$, iItem%)
Declare Sub      WComboItemClkT    Lib "TESTCtrl.dll" Alias "WComboItemClkT"    (lpszName$, lpszItem$)
Declare Sub      WComboItemDblClkT Lib "TESTCtrl.dll" Alias "WComboItemDblClkT" (lpszName$, lpszItem$)
Declare Sub      WComboClear       Lib "TESTCtrl.dll" Alias "WComboClear"       (lpszName$)
Declare Sub      WComboAddItem     Lib "TESTCtrl.dll" Alias "WComboAddItem"     (lpszName$, lpszItem$)
Declare Sub      WComboDelItem     Lib "TESTCtrl.dll" Alias "WComboDelItem"     (lpszName$, iItem%)
Declare Sub      WComboDelItemT    Lib "TESTCtrl.dll" Alias "WComboDelItemT"    (lpszName$, lpszItem$)
Declare Function WComboEnabled     Lib "TESTCtrl.dll" Alias "WComboEnabled"     (lpszName$) As Integer
Declare Sub      WComboSetFocus    Lib "TESTCtrl.dll" Alias "WComboSetFocus"    (lpszName$)

' Layered routines to simulate string functions for the coresponding
' TESTCtrl API
'----------------------------------------------------------------------------
Declare Function ComboText     (lpszName$) As String
Declare Function ComboSelText  (lpszName$) As String
Declare Function ComboItemText (lpszName$, iItem%) As String

'----------------------------------------------------------------------------
' ComboText: Layered routine for WComboText()
'----------------------------------------------------------------------------
Function ComboText(lpszName$) Static As String
Dim lpszBuffer As String
Dim itemLength As Integer
    ComboText = ""
    itemLength = WComboLen(lpszName$)
    If itemLength >= 0 Then
        lpszBuffer = String$(itemLength+1, " ")
        WComboText lpszName, lpszBuffer
        ComboText = lpszBuffer
    End If
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' ComboSelText: Layered routine for WComboSelText()
'----------------------------------------------------------------------------
Function ComboSelText(lpszName$) Static As String
Dim lpszBuffer As String
Dim itemLength As Integer
    ComboSelText = ""
    itemLength = WComboSelLen(lpszName$)
    If itemLength >= 0 Then
        lpszBuffer = String$(itemLength+1, " ")
        WComboSelText lpszName, lpszBuffer
        ComboSelText = lpszBuffer
    End If
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' ComboItemText: Layered routine for WComboItemText()
'----------------------------------------------------------------------------
Function ComboItemText(lpszName$, sItem%) Static As String
Dim lpszBuffer As String
Dim itemLength As Integer
    ComboItemText = ""
    itemLength = WComboItemLen(lpszName, sItem)
    If itemLength >= 0 Then
        lpszBuffer = String$(itemLength+1, " ")
        WComboItemText lpszName, sItem, lpszBuffer
        ComboItemText = lpszBuffer
    End If
    lpszBuffer = ""
End Function


'                                                       *********************
'$DEFINE W_COMBO_INCLUDED
'$ENDIF
'$IFDEF W_EDIT AND NOT W_EDIT_INCLUDED
'                                                       *********************


'*** Edit box routines
'
Declare Sub      WEditSetClass Lib "TESTCtrl.dll" Alias "WEditSetClass" (lpszClass$)
Declare Function WEditExists   Lib "TESTCtrl.dll" Alias "WEditExists"   (lpszName$) As Integer
Declare Function WEditLen      Lib "TESTCtrl.dll" Alias "WEditLen"      (lpszName$) As Long
Declare Sub      WEditText     Lib "TESTCtrl.dll" Alias "WEditText"     (lpszName$, lpszBuffer$)
Declare Sub      WEditSetText  Lib "TESTCtrl.dll" Alias "WEditSetText"  (lpszName$, lpszBuffer$)
Declare Sub      WEditSelText  Lib "TESTCtrl.dll" Alias "WEditSelText"  (lpszName$, lpszBuffer$)
Declare Function WEditSelLen   Lib "TESTCtrl.dll" Alias "WEditSelLen"   (lpszName$) As Long
Declare Sub      WEditLineText Lib "TESTCtrl.dll" Alias "WEditLineText" (lpszName$, lIndex&, lpszBuffer$)
Declare Function WEditLineLen  Lib "TESTCtrl.dll" Alias "WEditLineLen"  (lpszName$, lIndex&) As Long
Declare Function WEditPos      Lib "TESTCtrl.dll" Alias "WEditPos"      (lpszName$) As Long
Declare Function WEditLine     Lib "TESTCtrl.dll" Alias "WEditLine"     (lpszName$) As Long
Declare Function WEditChar     Lib "TESTCtrl.dll" Alias "WEditChar"     (lpszName$) As Long
Declare Function WEditFirst    Lib "TESTCtrl.dll" Alias "WEditFirst"    (lpszName$) As Long
Declare Function WEditLines    Lib "TESTCtrl.dll" Alias "WEditLines"    (lpszName$) As Long
Declare Sub      WEditClick    Lib "TESTCtrl.dll" Alias "WEditClick"    (lpszName$)
Declare Function WEditEnabled  Lib "TESTCtrl.dll" Alias "WEditEnabled"  (lpszName$) As Integer
Declare Sub      WEditSetFocus Lib "TESTCtrl.dll" Alias "WEditSetFocus" (lpszName$)

' Layered routines to simulate string functions for the coresponding
' TESTCtrl API
'----------------------------------------------------------------------------
Declare Function EditText     (lpszName$) As String
Declare Function EditSelText  (lpszName$) As String
Declare Function EditLineText (lpszName$, lIndex&) As String

'----------------------------------------------------------------------------
' EditText: Layered routine for WEditText()
'----------------------------------------------------------------------------
Function EditText(lpszName$) Static As String
Dim textLength As Long
Dim lpszBuffer As String
    EditText = ""
    textLength = WEditLen(lpszName)
    If textLength >= 0 Then
        lpszBuffer = String$(textLength+1, " ")
        WEditText lpszName, lpszBuffer
        EditText = lpszBuffer
    End If
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' EditSelText: Layered routine for WEditSelText()
'----------------------------------------------------------------------------
Function EditSelText(lpszName$) Static As String
Dim selLength  As Long
Dim lpszBuffer As String
    EditSelText = ""
    selLength = WEditSelLen(lpszName)
    If selLength >= 0 Then
        lpszBuffer = String$(selLength+1, " ")
        WEditSelText lpszName, lpszBuffer
        EditSelText = lpszBuffer
    End If
    lpszBuffer = ""
End Function

'----------------------------------------------------------------------------
' EditLineText: Layered routine for WEditLineText()
'----------------------------------------------------------------------------
Function EditLineText(lpszName$, lIndex&) Static As String
Dim lineLength As Long
Dim lpszBuffer As String
    EditLineText = ""
    lineLength = WEditLineLen(lpszName, lIndex)
    If lineLength >= 0 Then
        lpszBuffer = String$(lineLength+1, " ")
        WEditLineText lpszName, lIndex&, lpszBuffer
        EditLineText = lpszBuffer
    End if
    lpszBuffer = ""
End Function


'                                                       *********************
'$DEFINE W_EDIT_INCLUDED
'$ENDIF
'$IFDEF W_ERROR AND NOT W_ERROR_INCLUDED
'                                                       *********************


Declare Function WError     Lib "TESTCtrl.dll" Alias "WError"     () As Integer
Declare Sub      WErrorSet  Lib "TESTCtrl.dll" Alias "WErrorSet"  (iErrorNum%)
Declare Sub      WErrorText Lib "TESTCtrl.dll" Alias "WErrorText" (lpszBuffer$)
Declare Function WErrorLen  Lib "TESTCtrl.dll" Alias "WErrorLen"  () As Integer

' Layered routines to simulate string functions for the coresponding
' TESTCtrl API
'----------------------------------------------------------------------------
Declare Function ErrorText () As String

Const NO_ERROR                       =  0
Const ERR_MENU_NOT_FOUND             =  1
Const ERR_MENU_ITEM_NOT_FOUND        =  2
Const ERR_NOT_A_LISTBOX              =  3
Const ERR_LISTBOX_NOT_FOUND          =  4
Const ERR_ITEM_NOT_IN_LISTBOX        =  5
Const ERR_INVALID_LISTBOX_INDEX      =  6
Const ERR_LISTBOX_HAS_NO_STRINGS     =  7
Const ERR_LISTBOX_IS_NOT_MULTISELECT =  8
Const ERR_NOT_A_COMBOBOX             =  9
Const ERR_COMBOBOX_NOT_FOUND         = 10
Const ERR_ITEM_NOT_IN_COMBOBOX       = 11
Const ERR_INVALID_COMBOBOX_INDEX     = 12
Const ERR_COMBOBOX_HAS_NO_EDITBOX    = 13
Const ERR_COMBOBOX_HAS_NO_STRINGS    = 14
Const ERR_NOT_AN_EDITBOX             = 15
Const ERR_EDITBOX_NOT_FOUND          = 16
Const ERR_BUTTON_NOT_FOUND           = 17
Const ERR_OPTION_BUTTON_NOT_FOUND    = 18
Const ERR_CHECKBOX_NOT_FOUND         = 19
Const ERR_INVALID_WINDOW_HANDLE      = 20
Const ERR_NO_SYSTEM_MENU             = 21
Const ERR_INVALID_MENU_INDEX         = 22
Const MAX_ERROR                      = 23

'----------------------------------------------------------------------------
' ErrorText: Layered routine for WErrorText() of TESTCtrl.DLL.
'            Simulates a DLL String Function.
'----------------------------------------------------------------------------
Function ErrorText() Static As String
Dim lpszBuffer  As String
Dim errorLength As Integer
    errorLength= WErrorLen()
    lpszBuffer = String$(errorLength+1, " ")
    WErrorText lpszBuffer
    ErrorText = lpszBuffer
    lpszBuffer = ""
End Function


'                                                       *********************
'$DEFINE W_ERROR_INCLUDED
'$ENDIF
'$IFDEF W_ERROR_TRAP AND NOT W_ERROR_TRAP_INCLUDED
'                                                       *********************


'----------------------------------------------------------------------------
' WErrorTrap: This trap is in TESTCTRL.DLL.
'
'   This trap is here in MSTEST.INC just so it is easy to quickly add a
' trap that will display any TESTCTRL error messages.  It is only included if
' W_ERROR_TRAP is defined, so if WErrorTrap() is to be used for more than
' just to display the TESTCTRL error messages, W_ERROR_TRAP should no be
' defined. and a custom WErrorTrap() should be added to your script.
'----------------------------------------------------------------------------
Trap WErrorTrap From "TESTCTRL.DLL"
    Print WError;" ";ErrorText
End Trap


'                                                       *********************
'$DEFINE W_ERROR_TRAP_INCLUDED
'$ENDIF
'                                                       *********************