-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtlbcode1.bi
2166 lines (2026 loc) · 90.3 KB
/
tlbcode1.bi
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
sub GetPrefix()
sendmessage getdlgitem(hmain, idc_edt1), wm_gettext, 10, cast(lparam, @prefix)
END sub
Function TreeView_GetCheckState1( ByVal hWnd As Long, ByVal hItem As long ) As uinteger
Dim tvItem As TV_ITEM
dim as uinteger st1
tvItem.mask = TVIS_SELECTED'TVIF_HANDLE Or TVIF_STATE
tvItem.hItem = cast(HTREEITEM, hItem)
tvItem.stateMask = TVIS_SELECTED'TVIS_STATEIMAGEMASK
If TreeView_GetItem (cast(hwnd,hWnd), @tvItem ) = 0 Then
Return 0
Else
st1=tvItem.state
if st1 > 4193 THEN
Return 1
else
Return 0
END IF
End If
End Function
Function TreeView_GetItemText1(ByVal hTreeView As Long, ByVal hItem As Long) As String
Dim ItemText As zstring*32765
Dim Item As TV_ITEM
dim as integer gi1= TreeView_GetCheckState1(hTreeView,hItem)
'dim as integer gi2= IsTVItemChecked(hTreeView,hItem)
Item.hItem = cast(HTREEITEM, hItem)
Item.Mask = TVIF_TEXT
Item.cchTextMax = 32765
Item.pszText = @ItemText
SendMessage cast(hwnd,hTreeView), TVM_GETITEM, 0, cast(LPARAM,@Item)
if gi1=0 and xfull = 0 THEN
function= ItemText & " 'NOT'" ' 10 spaces
else
Function = ItemText
end if
'print "State = " & str(gi1) & crlf & ">" ;ItemText :print "State2 = " & str(gi2) :print
End Function
'function trait(st2 as string, ar() as string) as integer
' dim as integer x,n0
' dim as string s1, s2,st1,s3
' st1=rtrim (st2,any "' ")
' 'st1=left(st1,len(st1)-1)
' st1=Str_removeany(st1, "0123456789=-")
' st1=str_remove(st1, "Type(,,,,)")
' 'print st1
' dim i1 as integer = str_numparse(st1, ",")
' 'print "st1",st1
' 'print "i1",i1
' redim ar(1 to i1, 1 to 2) As string
' x=0
' for n0 = 1 to i1
' s1 = str_parse(st1, ",", n0)
' s1=rtrim(s1,any "') ")
' if s1 <> "" and instr(s1, " As ") > 0 THEN
' x += 1
' s2 = trim(str_parse(ucase(s1), " AS ", 1))
' if s2 = "" THEN s2 = "ANY_VAR"
' ar(x, 2) = s2
' s3=trim(str_parse(ucase(s1), " AS ", 2))
' select CASE s3
' CASE "LONG", "INTEGER", "INTEGER PTR", "LONG PTR"
' ar(x, 1) = "%d"
' CASE "ULONG", "UINTEGER", "ULONG PTR", "UINTEGER PTR"
' ar(x, 1) = "%u"
' CASE "SHORT", "SHORT PTR"
' ar(x, 1) = "%i"
' CASE "USHORT", "USHORT PTR"
' ar(x, 1) = "%I"
' CASE "LONGINT", "LONGINT PTR"
' ar(x, 1) = "%z"
' CASE "ULONGINT", "ULONGINT PTR"
' ar(x, 1) = "%Z"
' CASE "BSTR", "BSTR PTR"
' ar(x, 1) = "%B"
' CASE "STRING"
' ar(x, 1) = "%s"
' CASE "ZSTRING", "ZSTRING PTR"
' ar(x, 1) = "%s"
' CASE "WSTRING", "WSTRING PTR"
' ar(x, 1) = "%S"
' CASE "DOUBLE", "DOUBLE PTR" ,"FLOAT","FLOAT PTR","SINGLE","SINGLE PTR"
' ar(x, 1) = "%e"
' CASE "BOOL", "BOOL PTR"
' ar(x, 1) = "%b"
' CASE "VARIANT", "VARIANT PTR"
' ar(x, 1) = "%v"
' CASE "LPDISPATCH", "LPDISPATCH PTR", "IDISPATCH", "IDISPATCH PTR"
' ar(x, 1) = "%o"
' CASE "LPUNKNOWN", "LPUNKNOWN PTR", "IUNKNOWN PTR", "IUNKNOWN"
' ar(x, 1) = "%0"
' ' CASE "DATE_", "DATE_ PTR"
' ' ar(x, 1) = "%t"
' CASE "DATE", "DATE PTR"
' ar(x, 1) = "%D"
' CASE ELSE
' ar(x, 1) = "%p"
' END SELECT
' if right(s3,4)=" PTR" THEN
' s3=left(s3,len(s3)-4)
' ar(x, 2) ="@"& ar(x, 2)
' if right(s3,4)=" PTR" THEN ar(x, 2) ="@"& ar(x, 2)
' END IF
' end if
' NEXT
' 'print "fin",i1
' function = x
'END function
Sub putEvtList Cdecl Alias "putEvtList"(evt As String)
EvtList &= evt & "|"
'print EvtList
End Sub
Sub clrEvtList Cdecl Alias "clrEvtList"()
EvtList = ""
End Sub
Function inEvtList(evt As String) As Long
For i As Short = 1 To str_numparse(evtlist, "|")
If evt = str_parse(evtlist, "|", i) Then Return TRUE
Next
End Function
sub inEvtList2()
For i As Short = 1 To str_numparse(evtlist, "|")
'print str(i) & " : " & str_parse(evtlist, "|", i)
Next
End sub
'Function EnumInvoke1 cdecl (hTree As Long, hParent() As long) As zString Ptr
' Dim Parents() As Long
' Dim hNextItem As Long
' Dim HasChilds As Long
' Dim token As String, tldesc As String
' Dim hItem as Long
' Dim xface As String, memid As String, member As String
' Dim As Integer cpar
' ' Dim s22 as String
' Dim s as String,niveau1 as string,debut as string,niv3 as string
' dim as string str1
' dim inot as integer,icall as integer
' Dim s1 as String, s2 as string, prop as string,su as string ,sf as string
' dim i1 as integer, x1 as integer, x91 as integer
' Dim ar() As string
' GetPrefix()
' str1 = trim(prefix, any "-_ ")
' hItem = hparent(tkind_dispatch)
' tldesc = TreeView_GetItemText(hTree, cast(long, treeview_getnextitem(cast(hwnd, htree), hitem, TVGN_PARENT)))
' haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hitem))
' If haschilds Then
' niveau1 = "'" & String(80, "=") & crlf
' niveau1 &= "'Invoke - " & tldesc & crlf
' niveau1 &= "'" & String(80, "=") & crlf
' s=""
' hnextitem = haschilds
' While hnextitem
' token = TreeView_GetItemText1(hTree, hNextItem)
' if instr(token," 'NOT'") THEN
' token=left(token , len(token)-len(" 'NOT'"))
' inot=1
' else
' inot=0
' end if
' haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hnextitem))
' If (haschilds <> 0) And (UBound(parents) = 0) Then
' xface = str1 & str_parse(token, "?", 1)
' debut = "'" & String(80, "=") & crlf
' debut &= "'Dispatch " & xface & " ?" & str_parse(token, "?", 3) & crlf
' debut &= "'" & String(80, "=") & crlf
' debut &= d_bc & " Begin Model List : Disphelper syntax for " & xface & crlf & crlf
' niv3=""
' ElseIf (UBound(parents) <> 0) and inot=0 then
' memid = str_parse(token, "?", 1)
' member = str_parse(token, "?", 3)
' member = FF_Replace( member , "Const ", "")
' member=rtrim(member,any"'= " & dq)
' if instr(member,")")=0 and instr(member,"(")THEN member=member & ")"
' member = FF_Replace( member ,")As ",") As ")
' member = FF_Replace( member ," PTR"," Ptr")
' member = FF_Replace( member ," ptr"," Ptr")
' sf=""
' if right(member,12)= ") As any Ptr" then
' sf=" As any Ptr"
' member=left(member,len(member)- 11)
' end if
' member = FF_Replace( member , " As VARIANT", " As VARIANT Ptr")
' member = FF_Replace( member , " As VARIANT Ptr Ptr", " As VARIANT Ptr")
' i1=instr(ucase(member),"AS FUNCTION(")
' if i1>0 THEN member = left(member,i1 -1) & mid(member,i1 + 11)
' i1=instr(ucase(member),"AS SUB(")
' if i1>0 THEN member = left(member,i1 -1) & mid(member,i1 + 6)
' if instr(member,"QueryInterface (") =0 and instr(member,"AddRef (") =0 and _
' instr(member,"Release (") =0 and instr(member,"GetTypeInfoCount (") =0 and _
' instr(member,"GetTypeInfo (") =0 and instr(member,"GetIDsOfNames (") =0 and _
' instr(member,"Invoke (") =0 then
' 'print member
' prop=trim(str_parse(member, "(", 1),any " '")
' 'print prop
' member = "(" & str_parse(member, "(", 2)
' icall=0
' If InStr(member, "()") Then icall=1
' if left(ucase(prop),3)="SET" or left(ucase(prop),3)="PUT" THEN
' if sf="" THEN
' sf=str_parse(member, ")", 2)
' sf = FF_Replace( sf , " As VARIANT Ptr", " As VARIANT")
' if trim (sf,any " '" )<>"" and instr(sf,"As ") THEN
' if icall=1 THEN
' member=str_parse(member, ")", 1) & sf & " Ptr)"
' 'member=FF_Replace( member ,"()","(" & sf & " Ptr)" )
' icall=0
' else
' member=str_parse(member, ")", 1) & "," & sf & " Ptr)"
' 'member=FF_Replace( member ,")","," & sf & " Ptr)" )
' END IF
' else
' member=str_parse(member, ")", 1) & ")"
' END IF
' else
' member=str_parse(member, ")", 1) & ")"
' END IF
' 'print "set or put "; member
' su=left(ucase(prop),3)
' prop=mid(prop,4)
' elseif left(ucase(prop),3)="GET" THEN
' su="GET"
' prop=mid(prop,4)
' sf=str_parse(member, ")", 2)
' sf = FF_Replace( sf , " As VARIANT Ptr", " As VARIANT")
' if icall=1 THEN
' member=str_parse(member, ")", 1) & sf & " Ptr)"
' 'member=FF_Replace( member ,"()","(" & sf & " Ptr)" )
' icall=0
' else
' member=str_parse(member, ")", 1) & "," & sf & " Ptr)"
' 'member=FF_Replace( member ,")","," & sf & " Ptr)" )
' END IF
' 'print "get "; member
' else
' if sf="" THEN
' sf=str_parse(member, ")", 2)
' sf = FF_Replace( sf , " As VARIANT Ptr", " As VARIANT")
' if trim (sf,any " '" )<>"" and instr(sf,"As ") THEN
' if icall=1 THEN
' member=str_parse(member, ")", 1) & sf & " Ptr)"
' 'member=FF_Replace( member ,"()","(" & sf & " Ptr)" )
' icall=0
' else
' member=str_parse(member, ")",1) & "," & sf & " Ptr)"
' 'member=FF_Replace( member ,")","," & sf & " Ptr)" )
' END IF
' else
' member=str_parse(member, ")", 1) & ")"
' END IF
' else
' member=str_parse(member, ")", 1) & ")"
' END IF
' 'print "call "; member
' su=""
' END IF
' 'print prop
' 'print su
' if su="PUT" or su ="SET" THEN
' s2=""
' s1=""
' if icall=0 then
' s1=mid(member,len(str_parse(member, "(", 1))+2)
' i1=trait(s1,ar())
' if i1>1 THEN
' s1="( "
' for x1 = 1 to i1-1
' if x1< i1-1 then
' s1 &= ar(x1,1)& " , "
' else
' s1 &= ar(x1,1)& " ) "
' end if
' s2 &= " , " & ar(x1,2)
' NEXT
' end if
' s1 &= "=( " & ar(i1,1)& ")"
' s2 &= " , " & ar(i1,2)
' end if
' if su="PUT" THEN
' member = "Ax_Put " & str1 & "Obj_Ptr , ""." & prop & s1 & """" & s2 & " ' " & member
' elseif su="SET" THEN
' member = "Ax_Set " & str1 & "Obj_Ptr , ""." & prop & s1 & """" & s2 & " ' " & member
' end if
' elseif su="GET" THEN
' s1=mid(member,len(str_parse(member, "(", 1))+2)
' s1=FF_Replace( s1 ,")",",")
' 's1=str_parse(member, "(", 2)
' 's1=rtrim (str_parse(member, "(", 2),any ") '")
' i1=trait(s1,ar())
' s2=""
' s1=""
' if i1>1 THEN
' s1="( "
' for x1 = 1 to i1-1
' if x1< i1-1 then
' s1 &= ar(x1,1)& " , "
' else
' s1 &= ar(x1,1)& " ) "
' end if
' s2 &= " , "& ar(x1,2)
' NEXT
' end if
' member = "Ax_Get """ & ar(i1,1) & """ , " & ar(i1,2)& " , " & str1 & "Obj_Ptr , ""." & prop & s1 & """" & s2 & " ' " & member
' else
' if icall= 1 THEN
' member = """." & prop & """"
' else
' s1=mid(member,len(str_parse(member, "(", 1))+2)
' 's1=str_parse(member, "(", 2)
' 's1=rtrim (str_parse(member, "(", 2),any ") '")
' i1=trait(s1,ar())
' s2=""
' s1="( "
' for x1 = 1 to i1
' if x1 < i1 then
' s1 &= ar(x1,1)& " , "
' else
' s1 &= ar(x1,1)& " ) "
' end if
' s2 &= " , "& ar(x1,2)
' NEXT
' member = """." & prop & s1 & """" & s2 & " ' " & member
' end if
' member = "Ax_Call " & str1 & "Obj_Ptr , " & member
' END IF
' niv3 &= tb & member & crlf
' 's &=tb & prop & member & crlf
' End If
' End If
' If haschilds Then
' ReDim Preserve parents(UBound(parents) + 1)
' parents(UBound(parents)) = hnextitem
' hnextitem = haschilds
' Else
' hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), hnextitem, TVGN_NEXT))
' If hnextitem = 0 And UBound(parents) > 0 Then
' hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), parents(UBound(parents)), TVGN_NEXT))
' ReDim Preserve parents(UBound(parents) - 1)
' if niv3<>"" then
' x91 +=1
' niv3 &= crlf & " End Model List for " & xface & " " & f_bc & crlf & crlf & crlf
' niv3= debut & niv3
' s &= niv3
' niv3=""
' debut = ""
' end if
' 's &= tb & "pMark As Integer = -1" & crlf
' 's &= tb & "pThis As Integer" & crlf
' 's &= "End Type ' " & xface & crlf & crlf
' End If
' End If
' Wend
' if s<>"" and xfull =1 then
' s = niveau1 & s
' elseif s<>"" then
' s = niveau1 & s
' if x91 >1 THEN
' s= crlf & crlf & "'More than 1 Invoke Dispach item selected on the tree , reselect the only one you need" & crlf & crlf & s
' xret2=1
' END IF
' else
' s= crlf & crlf & "'No Invoke Dispach item selected on the tree , reselect the functions you need" & crlf & crlf
' xret2=1
' end if
' End If
' 'print s22
' Return cast(zstring ptr, sysallocstringbytelen(s, len(s)))
'End Function
'Function EnumModel cdecl(hTree As Long, hParent() As long) As zString Ptr
' Dim Parents() As Long
' Dim hNextItem As Long
' Dim HasChilds As Long
' Dim hItem1 as Long
' Dim token As String, s0 As String, tldesc As String,niveau1 as string,debut as string,niv3 as string
' Dim xface As String, memid As Integer, member As String, offs As Integer
' dim inot as integer,icall as integer
' Dim s as String
' Dim s1 as String, s2 as string, prop as string
' dim i1 as integer, x1 as integer, x91 as integer
' Dim ar() As string
' dim as string str1
' GetPrefix()
' str1 = trim(prefix, any "-_ ")
' if str1 <> "" THEN str1 = str1 & "_"
' hItem1 = hparent(tkind_interface)
' tldesc = TreeView_GetItemText(hTree, cast(long, treeview_getnextitem(cast(hwnd, htree), hitem1, TVGN_PARENT)))
' 'print "tldesc" : print tldesc : print
' haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hitem1))
' If haschilds Then
' niveau1 = "'" & String(80, "=") & crlf
' niveau1 &= "'Template DispHelper code - " & tldesc & crlf
' niveau1 &= "'" & String(80, "=") & crlf
' s=""
' hnextitem = haschilds
' While hnextitem
' token = TreeView_GetItemText1(hTree, hNextItem)
' 'print "token" : print token : print
' if instr(token," 'NOT'") THEN
' token=left(token , len(token)-len(" 'NOT'"))
' inot=1
' else
' inot=0
' end if
' haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hnextitem))
' If haschilds <> 0 And UBound(parents) = 0 Then
' xface = str_parse(token, "?", 1)
' debut = "'" & String(80, "=") & crlf
' debut &= "'vTable Interface : " & xface & crlf
' debut &= "'" & String(80, "=") & crlf & crlf
' debut &= d_bc & " Begin Model List : Disphelper syntax for " & xface & crlf & crlf
' niv3=""
' ElseIf (UBound(parents) <> 0) and inot=0 Then
' memid = Val(str_parse(token, "?", 1))
' member = str_parse(token, "?", 3) & " '" & str_parse(token, "?", 4)
' member = FF_Replace( member , " As VARIANT", " As VARIANT Ptr")
' member = FF_Replace( member , " As VARIANT Ptr Ptr", " As VARIANT Ptr")
' 'member=str_ReplaceAll(" As VARIANT ", " As VARIANT XXX", member)
' 'member=str_ReplaceAll(" As VARIANT XXX Ptr", " As VARIANT Ptr ", member)
' 'member=str_ReplaceAll(" As VARIANT XXX", " As VARIANT ptr", member)
' 'member=str_ReplaceAll(" As VARIANT Ptr ", "_ret As VARIANT Ptr", member)
' i1=instr(ucase(member),"AS FUNCTION(")
' if i1>0 THEN
' member = left(member,i1 -1) & mid(member,i1 + 11)
' END IF
' i1=instr(ucase(member),"AS SUB(")
' if i1>0 THEN member = left(member,i1 -1) & mid(member,i1 + 6)
' i1=instr(ucase(member),"AS HRESULT")
' if i1>0 THEN member = left(member,i1 -1)
' If offs = 0 Then
' If memid > 8 Then
' offs = 8
' End If
' If memid > 24 Then
' offs = 24
' End If
' End If
' s0 = ""
' 'offs = memid - offs - 4
' offs = memid
' prop=trim(str_parse(member, "(", 1),any " '")
' icall=0
' If InStr(member, "()") Then
' member= left(member,InStr(member, "()")-4)
' icall=1
' Else
' member= str_parse(member, "(", 1) & Mid(member, Len(str_parse(member, "(", 1))+1)
' End If
' if (ucase(left(member,3))="PUT" or ucase(left(member,3))="SET") and icall= 0 THEN
' prop=mid(prop,4)
' s1=mid(member,len(str_parse(member, "(", 1))+2)
' 's1=str_parse(member, "(", 2)
' 's1=rtrim (str_parse(member, "(", 2),any ") '")
' i1=trait(s1,ar())
' s2=""
' s1=""
' if i1>1 THEN
' s1="( "
' for x1 = 1 to i1-1
' if x1< i1-1 then
' s1 &= ar(x1,1)& " , "
' else
' s1 &= ar(x1,1)& " ) "
' end if
' s2 &= " , " & ar(x1,2)
' NEXT
' end if
' s1 &= "=( " & ar(i1,1)& ")"
' s2 &= " , " & ar(i1,2)
' if ucase(left(member,3))="PUT" THEN
' member = "Ax_Put " & str1 & "Obj_Ptr , ""." & prop & s1 & """" & s2 & " ' " & member
' elseif ucase(left(member,3))="SET" THEN
' member = "Ax_Set " & str1 & "Obj_Ptr , ""." & prop & s1 & """" & s2 & " ' " & member
' end if
' elseif ucase(left(member,3))="GET" and icall= 0 THEN
' prop=mid(prop,4)
' s1=mid(member,len(str_parse(member, "(", 1))+2)
' 's1=str_parse(member, "(", 2)
' 's1=rtrim (str_parse(member, "(", 2),any ") '")
' i1=trait(s1,ar())
' s2=""
' s1=""
' if i1>1 THEN
' s1="( "
' for x1 = 1 to i1-1
' if x1< i1-1 then
' s1 &= ar(x1,1)& " , "
' else
' s1 &= ar(x1,1)& " ) "
' end if
' s2 &= " , "& ar(x1,2)
' NEXT
' end if
' member = "Ax_Get """ & ar(i1,1) & """ , " & ar(i1,2)& " , " & str1 & "Obj_Ptr , ""." & prop & s1 & """" & s2 & " ' " & member
' else
' if instr (member ,"(")=0 THEN
' member = """." & prop & """"
' else
' s1=mid(member,len(str_parse(member, "(", 1))+2)
' 's1=str_parse(member, "(", 2)
' 's1=rtrim (str_parse(member, "(", 2),any ") '")
' i1=trait(s1,ar())
' s2=""
' s1="( "
' for x1 = 1 to i1
' if x1 < i1 then
' s1 &= ar(x1,1)& " , "
' else
' s1 &= ar(x1,1)& " ) "
' end if
' s2 &= " , "& ar(x1,2)
' NEXT
' member = """." & prop & s1 & """" & s2 & " ' " & member
' end if
' member = "Ax_Call " & str1 & "Obj_Ptr , " & member
' END IF
' niv3 &= tb & member & crlf
' End If
' If haschilds Then
' ReDim Preserve parents(UBound(parents) + 1)
' parents(UBound(parents)) = hnextitem
' hnextitem = haschilds
' Else
' hnextitem = cast(long,treeview_getnextitem(cast(hwnd,htree), hnextitem, TVGN_NEXT))
' If hnextitem = 0 And UBound(parents) > 0 Then
' hnextitem = cast(long,treeview_getnextitem(cast(hwnd,htree), parents(UBound(parents)), TVGN_NEXT))
' ReDim Preserve parents(UBound(parents) - 1)
' if niv3<>"" then
' x91 +=1
' niv3 &= crlf & " End Model List for " & xface & " " & f_bc & crlf & crlf & crlf
' niv3= debut & niv3
' s &= niv3
' niv3=""
' debut = ""
' end if
' offs = 0
' End If
' End If
' Wend
' if s<>"" and xfull =1 then
' s = niveau1 & s
' elseif s<>"" then
' s = niveau1 & s
' if x91 >1 THEN
' s= crlf & crlf & "'More than 1 vTable Interface item selected on the tree , reselect the only one you need" & crlf & crlf & s
' xret2=1
' END IF
' else
' s= crlf & crlf & "'No vTable Interface item selected on the tree , reselect the functions you need" & crlf & crlf
' xret2=1
' end if
' End If
'Return cast(zstring ptr, sysallocstringbytelen(s, len(s)))
'End Function
Function EnumCoClass2 (hTree As Long, hParent() As long) As String
Dim Parents() As Long
Dim hNextItem As Long
Dim HasChilds As Long
Dim token As String
Dim As String clsids, tldesc
Dim hItem as long
Dim s as string
redim Parents(0)
hItem = hparent(tkind_coclass)
tldesc = TreeView_GetItemText(hTree, cast(long, treeview_getnextitem(cast(hwnd, htree), hitem, TVGN_PARENT)))
haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hitem))
If haschilds Then
hnextitem = haschilds
While hnextitem
token = TreeView_GetItemText(hTree, hNextItem)
clsids &= str_parse(token, "?", 1) & "=" & dq & str_parse(token, "?", 2) & dq & crlf
hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), hnextitem, TVGN_NEXT))
Wend
End If
's &= "'CLSID - " & tldesc & crlf
s &= clsids & crlf
Return s
End Function
Function EnumvTable cdecl Alias "EnumvTable"(hTree As Long, hParent() As long) As zString Ptr
Dim Parents() As Long
Dim hNextItem As Long
Dim HasChilds As Long
Dim hItem1 as Long,virg as integer,xvir as integer,in1 as integer,bevent as integer
Dim token As String, s0 As String, tldesc As String, cor1 as string, cor2 as string, cor3 as string,sp1 as string
Dim xface As String, memid As Integer, member As String, offs As Integer
redim Parents(0)
Dim s as String,us as string,xface0 as string,svt as string,s1 as string
dim as string str1, strclasses, interf, siid
GetPrefix()
'strclasses =EnumCoClass2 (hTree , hParent())
's &=strclasses
str1 = trim(prefix, any "-_ ")
hItem1 = hparent(tkind_interface)
tldesc = TreeView_GetItemText(hTree, cast(long, treeview_getnextitem(cast(hwnd, htree), hitem1, TVGN_PARENT)))
'print "tldesc = " ; tldesc
haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hitem1))
'print "haschilds = ";haschilds
If haschilds Then
svt &= "'" & String(80, "=") & crlf
svt &= "'vTable - " & tldesc & crlf
svt &= "'" & String(80, "=") & crlf
hnextitem = haschilds
While hnextitem
token = TreeView_GetItemText(hTree, hNextItem)
'print "token = ";token
haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hnextitem))
'haschilds = treeview_getchild( htree, hnextitem)
'print "haschilds =";haschilds ; " UBound(parents)= " ;UBound(parents)
If haschilds <> 0 And UBound(parents) = 0 Then
'If haschilds <> 0 And UBound(parents) < 1 Then
interf = str_parse(token, "?", 2)
'print "interf >" ; interf ; "<"
'xface = str1 & str_parse(token, "?", 1)
xface = str_parse(token, "?", 1)
xface0=xface
xface= str1 & xface
bevent = inevtlist(xface0)
If bevent=0 THEN
if instr(ucase(xface0),"EVENT") THEN bevent= 2
end if
s1 = "'" & String(80, "=") & crlf
s1 &= "'Interface " & xface & " ?" & str_parse(token, "?", 3) & crlf
s1 &= "'Const IID_" & xface & "=" & dq & str_parse(token, "?", 2) & dq & crlf
s1 &= "'" & String(80, "=") & crlf
s1 &= "Type " & xface & "vTbl" & crlf
ElseIf (UBound(parents) <> 0) Then
'ElseIf (UBound(parents) > 0) Then
memid = Val(str_parse(token, "?", 1))
member = str_parse(token, "?", 3) & " '" & str_parse(token, "?", 4)
'print " memid = " & memid
'print "member = " & member
If offs = 0 Then
If memid > 8 Then
s1 &= tb & "QueryInterface As Function (Byval pThis As Any ptr,Byref riid As GUID,Byref ppvObj As Dword) As hResult" & crlf
s1 &= tb & "AddRef As Function (Byval pThis As Any ptr) As Ulong" & crlf
s1 &= tb & "Release As Function (Byval pThis As Any ptr) As Ulong" & crlf
offs = 8
End If
If memid > 24 Then
s1 &= tb & "GetTypeInfoCount As Function (Byval pThis As Any ptr,Byref pctinfo As Uinteger) As hResult" & crlf
s1 &= tb & "GetTypeInfo As Function (Byval pThis As Any ptr,Byval itinfo As Uinteger,Byval lcid As Uinteger,Byref pptinfo As Any Ptr) As hResult" & crlf
s1 &= tb & "GetIDsOfNames As Function (Byval pThis As Any ptr,Byval riid As GUID,Byval rgszNames As Byte,Byval cNames As Uinteger,Byval lcid As Uinteger,Byref rgdispid As Integer) As hResult" & crlf
s1 &= tb & "Invoke As Function (Byval pThis As Any ptr,Byval dispidMember As Integer,Byval riid As GUID,Byval lcid As Uinteger,Byval wFlags As Ushort,Byval pdispparams As DISPPARAMS,Byref pvarResult As Variant,Byref pexcepinfo As EXCEPINFO,Byref puArgErr As Uinteger) As hResult" & crlf
offs = 24
End If
End If
s0 = ""
offs = memid - offs - 4
If offs > 0 Then s0 = "(" &(offs - 1) & ") As Byte" & crlf
offs = memid
If Len(s0) Then s1 &= tb & "Offset" & offs & s0
' if instr(ucase(member),")AS HRESULT ") = 0 and instr(ucase(member),") AS HRESULT ") = 0 then
' if instr(member," As Function(")>0 then
' member=FF_replace(member," As Function("," As Sub(")
' end if
' 'print member
' end if
If InStr(member, "()") and InStr(member, " As Sub()")>0 Then
s1 &= tb & str_parse(member, "(", 1) & "(ByVal pThis As Any Ptr)" & crlf
elseIf InStr(member, "()") and InStr(member, " As Function()")>0 Then
s1 &= tb & str_parse(member, "(", 1) & "(ByVal pThis As Any Ptr" & Mid(member, Len(str_parse(member, "(", 1)) + 2, - 1) & crlf
ElseIf InStr(member, "()")= 0 then
cor1= str_parse(member, "(", 1) & "(ByVal pThis As Any Ptr," & Mid(member, Len(str_parse(member, "(", 1)) + 2, - 1) & crlf
sp1= ") As " & str_parse(cor1,") As ",str_numparse(cor1, ") As " ))
cor1= str_parse(cor1,") As ",1)
virg = str_numparse(cor1, "," )
for xvir = 2 to virg
cor2 = str_parse(cor1, "," , xvir)
if instr(cor2," As ") THEN
cor3 = "ByVal " & cor2
cor1 = FF_Replace( cor1 ,cor2,cor3)
END IF
NEXT
cor1 = FF_Replace( cor1 ,",ByVal As",",ByVal VarAny As")
s1 &= tb & cor1 & sp1
End If
End If
If haschilds Then
ReDim Preserve parents(UBound(parents) + 1)
parents(UBound(parents)) = hnextitem
hnextitem = haschilds
Else
hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), hnextitem, TVGN_NEXT))
If hnextitem = 0 And UBound(parents) > 0 Then
hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), parents(UBound(parents)), TVGN_NEXT))
ReDim Preserve parents(UBound(parents) - 1)
s1 &= "End Type '" & xface & "vTbl" & crlf & crlf
s1 &= "Type " & xface & "_"& crlf
s1 &= tb & "lpvtbl As " & xface & "vTbl Ptr" & crlf
s1 &= "End Type" & crlf & crlf
if bevent=0 then us &= tb & "Type " & xface & " as " & xface & "_ ' Interface : " & xface & crlf
s1 &= tb & "' best way to do ... Dim Shared As " & xface & " ptr " & str1 & "pVTI " & crlf
s1 &= tb & "' ex: " & str1 & "pVTI->lpvtbl->SetColor( " & str1 & "pVTI ,...)" & crlf
s1 &= tb & "' or Ax_Vt ( " & str1 & "pVTI , SetColor ,...)" & crlf
s1 &= tb & "' or Ax_Vt0 ( " & str1 & "pVTI , About )" & crlf & crlf
in1=0
for xvir = 1 to icoclass
if coclass(xvir,5) = interf THEN
'print coclass(xvir,4)
in1=xvir
exit for
END IF
NEXT
if in1 THEN
s1 &= "Function Create_" & xface & "() As any ptr" & crlf
s1 &= tb & "Function = AxCreate_object( """ & coclass(in1,3) & """ , """ & coclass(in1,5)& """ )" & crlf
s1 &= "End Function" & crlf & crlf
s1 &= " ' use normaly like that : " & str1 & "pVTI = " & str1 & "Obj_Ptr" & crlf
s1 &= " ' but if problem try : " & str1 & "pVTI = Create_" & xface & "()" & crlf & crlf & crlf
else
s1 &= " ' use " & str1 & "pVTI = " & str1 & "Obj_Ptr" & crlf & crlf & crlf
END IF
if bevent=0 then s &= s1
offs = 0
End If
End If
Wend
End If
if s <> "" THEN
s = "'" & String(80, "*") & crlf & "' Interface vTable Types :" & crlf & crlf & us & crlf & crlf & "'" & String(80, "*") & crlf & crlf & s
s = svt & crlf & crlf & s
END IF
'print s
if instr(s , " _Collection Ptr" ) THEN
us= "'================================================================================" & crlf & crlf
us &= "'Interface _Collection , Standard Vb6/Vba collection vTable needed here" & crlf & crlf
us &= "Type _CollectionvTbl" & crlf
us &= tb & "QueryInterface As Function (Byval pThis As Any ptr,Byref riid As GUID,Byref ppvObj As Dword) As hResult" & crlf
us &= tb & "AddRef As Function (Byval pThis As Any ptr) As Ulong" & crlf
us &= tb & "Release As Function (Byval pThis As Any ptr) As Ulong" & crlf
us &= tb & "GetTypeInfoCount As Function (Byval pThis As Any ptr,Byref pctinfo As Uinteger) As hResult" & crlf
us &= tb & "GetTypeInfo As Function (Byval pThis As Any ptr,Byval itinfo As Uinteger,Byval lcid As Uinteger,Byref pptinfo As Any Ptr) As hResult" & crlf
us &= tb & "GetIDsOfNames As Function (Byval pThis As Any ptr,Byval riid As GUID,Byval rgszNames As Byte,Byval cNames As Uinteger,Byval lcid As Uinteger,Byref rgdispid As Integer) As hResult" & crlf
us &= tb & "Invoke As Function (Byval pThis As Any ptr,Byval dispidMember As Integer,Byval riid As GUID,Byval lcid As Uinteger,Byval wFlags As Ushort,Byval pdispparams As DISPPARAMS,Byref pvarResult As Variant,Byref pexcepinfo As EXCEPINFO,Byref puArgErr As Uinteger) As hResult" & crlf
us &= tb & "Item As Function(ByVal pThis As Any Ptr,ByVal Index As VARIANT Ptr,ByVal pvarRet As VARIANT Ptr) As HRESULT '" & crlf
us &= tb & "Add As Function(ByVal pThis As Any Ptr,ByVal Item As VARIANT Ptr,ByVal Key As VARIANT Ptr=0,ByVal Before As VARIANT Ptr=0,ByVal After As VARIANT Ptr=0) As HRESULT '" & crlf
us &= tb & "Count As Function(ByVal pThis As Any Ptr,ByVal pi4 As Integer Ptr) As HRESULT '" & crlf
us &= tb & "Remove As Function(ByVal pThis As Any Ptr,ByVal Index As VARIANT Ptr) As HRESULT '" & crlf
us &= tb & "_NewEnum As Function(ByVal pThis As Any Ptr,ByVal ppunk As LPUNKNOWN Ptr) As HRESULT '" & crlf
us &= "End Type '_CollectionvTbl" & crlf & crlf
us &= "Type _Collection" & crlf
us &= tb & "lpvtbl As _CollectionvTbl Ptr" & crlf
us &= "End Type" & crlf
us &= "'================================================================================" & crlf
s = us & crlf & s
END IF
Return cast(zstring ptr, sysallocstringbytelen(s, len(s)))
End Function
Function EnumInvoke cdecl Alias "EnumInvoke"(hTree As Long, hParent() As long) As zString Ptr
Dim Parents() As Long
Dim hNextItem As Long
Dim HasChilds As Long
Dim token As String, tldesc As String
Dim hItem as Long
Dim xface As String, memid As String, member As String,s1 as string,xface0 as string,sinv as string
Dim As Integer cpar, bevent
' Dim s22 as String
Dim s as String
dim as string str1
redim Parents(0)
GetPrefix()
str1 = trim(prefix, any "-_ ")
'inEvtList2()
hItem = hparent(tkind_dispatch)
tldesc = TreeView_GetItemText(hTree, cast(long, treeview_getnextitem(cast(hwnd, htree), hitem, TVGN_PARENT)))
haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hitem))
If haschilds Then
sinv = "'" & String(80, "=") & crlf
sinv &= "'Invoke - " & tldesc & crlf
sinv &= "'" & String(80, "=") & crlf
hnextitem = haschilds
While hnextitem
token = TreeView_GetItemText(hTree, hNextItem)
haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hnextitem))
If (haschilds <> 0) And (UBound(parents) = 0) Then
'xface = str1 & str_parse(token, "?", 1)
xface = str_parse(token, "?", 1)
xface0=xface
xface= str1 & xface
bevent = inevtlist(xface0)
If bevent=0 THEN
if instr(ucase(xface0),"EVENT") THEN bevent= 2
end if
'print xface0 & " = " & str(bevent)
s1 = "'" & String(80, "=") & crlf
s1 &= "'Dispatch " & xface & " ?" & str_parse(token, "?", 3) & crlf
s1 &= "'Const IID_" & xface & "=" & dq & str_parse(token, "?", 2) & dq & crlf
s1 &= "'" & String(80, "=") & crlf
s1 &= "Type " & xface & crlf
ElseIf (UBound(parents) <> 0) then
memid = str_parse(token, "?", 1)
member = str_parse(token, "?", 3)
member = FF_Replace( member , "Const ", "")
member=rtrim(member,any"'= " & dq)
if instr(member,")")=0 and instr(member,"(")THEN member=member & ")"
cpar = str_numparse(member, ",")
If Len(str_parse(str_parse(member, "(", 2), ")", 1)) = 0 Then cpar = 0
s1 &=tb & str_parse(member," As ",1) & " As tMember = ("
's22 &=tb & str_parse(member," As ",1)
s1 &= memid & ",2," & cpar & "," & str_parse(token,"?",2) & ") '" & str_remove(member,str_parse(member," As ",1)) & crlf
' s22 &=str_remove(member,str_parse(member," As ",1)) & crlf
End If
If haschilds Then
ReDim Preserve parents(UBound(parents) + 1)
parents(UBound(parents)) = hnextitem
hnextitem = haschilds
Else
hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), hnextitem, TVGN_NEXT))
If hnextitem = 0 And UBound(parents) > 0 Then
hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), parents(UBound(parents)), TVGN_NEXT))
ReDim Preserve parents(UBound(parents) - 1)
s1 &= tb & "pMark As Integer = -1" & crlf
s1 &= tb & "pThis As Integer" & crlf
s1 &= "End Type ' " & xface & crlf & crlf
s1 &= " 'Use like that to use these dispach/invoke functions" & crlf
s1 &= " ' Dim Shared As " & xface & " " & str1 & "Obj_Disp" & crlf
s1 &= " ' SetObj ( @" & str1 & "Obj_Disp , " & str1 & "Obj_Ptr ) ' connect to object" & crlf
s1 &= " ' ex : AxCall " & str1 & "Obj_Disp.putMonth,vptr(05)" & crlf & crlf & crlf
if bevent =0 THEN s &=s1
End If
End If
Wend
if s <> "" THEN s = sinv & crlf & crlf & s
End If
'print s22
Return cast(zstring ptr, sysallocstringbytelen(s, len(s)))
End Function
Function EnumEvent2 (hTree As Long, hParent() As long, hItem as Long )as String
Dim Parents() As Long
Dim hNextItem As Long
Dim HasChilds As Long
Dim token As String, tldesc As String
Dim As String xface, member, help, temp ,xface0,us,memberF,memberV, temp2
Dim As Integer bevent,numF,x1,itemp
Dim s as String
dim as string str1,st_evt(),st_M(),sieven ',st_F()
redim Parents(0)
redim st_evt(0)
'redim st_F(0)
redim st_M(0)
numF = 0
GetPrefix()
str1 = trim(prefix, any "-_ ")
'print "sevent = " ; sevent
'hItem = hparent(tkind_interface)
tldesc = str1 & TreeView_GetItemText(hTree, cast(long, treeview_getnextitem(cast(hwnd, htree), hitem, TVGN_PARENT)))
haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hitem))
If haschilds Then
us = "'" & String(80, "=") & crlf
us &= "'Event - " & tldesc & crlf
us &= "'" & String(80, "=") & crlf
hnextitem = haschilds
While hnextitem
token = TreeView_GetItemText(hTree, hNextItem)
haschilds = cast(long, treeview_getchild(cast(hwnd, htree), hnextitem))
If (haschilds <> 0) And (UBound(parents) = 0) Then
xface = str_parse(token, "?", 1)
xface0=xface
xface= str1 & xface
bevent = inevtlist(xface0)
If bevent Then
sieven = str_parse(token, "?", 2)
'print "sieven = " ; sieven
if sevent = "" or sieven = sevent THEN
s &= "'" & String(80, "=") & crlf
s &= "'Event vTable - " & xface & " ?" & str_parse(token, "?", 3) & crlf
s &= "Const " & xface & "_Ev_IID_CP = " & dq & str_parse(token, "?", 2) & dq & crlf
s &= "'" & String(80, "=") & crlf & crlf & crlf
END IF
End If
ElseIf (UBound(parents) <> 0) then
numF +=1
memberF = str_parse(token, "?", 3)
memberF = FF_Replace(memberF," "," ")
memberF = FF_Replace(memberF," "," ")
memberF = FF_Replace(memberF," "," ")
memberF = FF_Replace(memberF," "," ")
memberF = trim (memberF)
temp2 = memberF
memberF = lcase(memberF)
help = str_parse(token, "?", 4)
redim preserve st_evt(1 to numF )
'redim preserve st_F(1 to numF)
redim preserve st_M(1 to numF)
itemp = instr(memberF, " as ")
member = left(temp2,itemp -1)
st_M(numF)= xface & "_" & member
If InStr(memberF, " as sub()")>0 or InStr(memberF, " as sub ()")> 0 _
or InStr(memberF, " as sub ( )")>0 or InStr(memberF, " as sub( )")>0 Then
memberF= member & " As Sub ( ByVal pThis As Any Ptr )"
elseIf InStr(memberF, " as function()")>0 or InStr(memberF, " as function ()")> 0 _
or InStr(memberF, " as function ( )")>0 or InStr(memberF, " as function( )")>0 Then
memberF= member & " As Function ( ByVal pThis As Any Ptr )" & str_parse(temp2, ")", 2)
elseIf InStr(memberF, " as function(")>0 or InStr(memberF, " as function (")> 0 then
memberF= member & " As Function ( ByVal pThis As Any Ptr , " & str_parse(temp2, "(", 2)
elseIf InStr(memberF, " as sub(")>0 or InStr(memberF, " as sub (")> 0 then
memberF= member & " As Sub ( ByVal pThis As Any Ptr , " & str_parse(temp2, "(", 2)
end if
st_evt(numF )= memberF
'print memberF
temp = mid(memberF, instr(memberF," As ") +3)
temp = trim(temp)
'print " temp = " & temp & " numf = " & str(numF)
if left(temp,3)="Sub" THEN
temp = "Sub " & st_M(numF) & "( " & str_parse(temp, "(", 2)
else
temp = "Function " & st_M(numF) & "( " & str_parse(temp, "(", 2)
END IF
If bevent and (sevent = "" or sieven = sevent) Then
s &= "'" & String(80, "=") & crlf
s &= "'Event # " & str(numF) & " " & member & " ? " & help & crlf
s &= "'" & String(80, "=") & crlf
memberV = temp
s &= memberV & crlf & crlf
s &= tb & "'*** Put your code here ***" & crlf & crlf & crlf
if left(ucase(memberV),3)="SUB" THEN
s &= "End Sub" & crlf & crlf
else
s &= tb & "Function = S_OK ' change if needed" & crlf
s &= "End Function" & crlf & crlf
END IF
End If
End If
If haschilds Then
ReDim Preserve parents(UBound(parents) + 1)
parents(UBound(parents)) = hnextitem
hnextitem = haschilds
Else
hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), hnextitem, TVGN_NEXT))
If hnextitem = 0 And UBound(parents) > 0 Then
hnextitem = cast(long, treeview_getnextitem(cast(hwnd, htree), parents(UBound(parents)), TVGN_NEXT))
ReDim Preserve parents(UBound(parents) - 1)
If bevent and (sevent = "" or sieven = sevent) and numF >0 Then