forked from syntax53/Nightmare-Redux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmDatabaseDeleter.frm
1647 lines (1470 loc) · 50.6 KB
/
frmDatabaseDeleter.frm
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
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmDatabaseDeleter
BorderStyle = 1 'Fixed Single
Caption = "Record Deleter"
ClientHeight = 6015
ClientLeft = 45
ClientTop = 330
ClientWidth = 4230
Icon = "frmDatabaseDeleter.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 6015
ScaleWidth = 4230
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "&Cancel / Close"
Height = 375
Left = 2520
TabIndex = 52
Top = 5280
Width = 1575
End
Begin VB.CommandButton cmdGo
Caption = "&Delete Selected"
Height = 375
Left = 120
TabIndex = 51
Top = 5280
Width = 1515
End
Begin VB.Frame fra1
Height = 4755
Left = 120
TabIndex = 0
Top = 60
Width = 3975
Begin VB.TextBox txtRoomMap
Height = 285
Left = 2820
TabIndex = 39
Text = "0"
Top = 3720
Width = 435
End
Begin VB.TextBox txtRoomsFrom
Height = 285
Left = 2220
TabIndex = 40
Text = "0"
Top = 3360
Width = 735
End
Begin VB.TextBox txtRoomsTo
Height = 285
Left = 3060
TabIndex = 41
Text = "9999"
Top = 3360
Width = 735
End
Begin VB.CheckBox Check11
Caption = "Check1"
Enabled = 0 'False
Height = 195
Left = 1740
TabIndex = 47
Top = 4365
Value = 2 'Grayed
Width = 195
End
Begin VB.CheckBox Check10
Caption = "Check1"
Enabled = 0 'False
Height = 195
Left = 1740
TabIndex = 45
Top = 4050
Value = 2 'Grayed
Width = 195
End
Begin VB.CheckBox chkTextblocksAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 34
Top = 3030
Width = 195
End
Begin VB.CheckBox chkMessagesAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 30
Top = 2670
Width = 195
End
Begin VB.CheckBox Check7
Caption = "Check1"
Enabled = 0 'False
Height = 195
Left = 1740
TabIndex = 43
Top = 3720
Value = 2 'Grayed
Width = 195
End
Begin VB.CheckBox chkRoomsAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 38
Top = 3390
Width = 195
End
Begin VB.CheckBox chkClassesAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 26
Top = 2310
Width = 195
End
Begin VB.CheckBox chkRacesAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 22
Top = 1965
Width = 195
End
Begin VB.CheckBox chkShopsAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 18
Top = 1620
Width = 195
End
Begin VB.CheckBox chkSpellsAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 14
Top = 1260
Width = 195
End
Begin VB.CheckBox chkMonstersAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 10
Top = 900
Width = 195
End
Begin VB.TextBox txtTextblocksTo
Height = 285
Left = 3060
TabIndex = 36
Text = "9999"
Top = 2985
Width = 735
End
Begin VB.TextBox txtTextblocksFrom
Height = 285
Left = 2220
TabIndex = 35
Text = "0"
Top = 2985
Width = 735
End
Begin VB.TextBox txtMessagesTo
Height = 285
Left = 3060
TabIndex = 32
Text = "9999"
Top = 2640
Width = 735
End
Begin VB.TextBox txtMessagesFrom
Height = 285
Left = 2220
TabIndex = 31
Text = "0"
Top = 2625
Width = 735
End
Begin VB.TextBox txtClassesTo
Height = 285
Left = 3060
TabIndex = 28
Text = "9999"
Top = 2265
Width = 735
End
Begin VB.TextBox txtClassesFrom
Height = 285
Left = 2220
TabIndex = 27
Text = "0"
Top = 2265
Width = 735
End
Begin VB.TextBox txtRacesTo
Height = 285
Left = 3060
TabIndex = 24
Text = "9999"
Top = 1920
Width = 735
End
Begin VB.TextBox txtRacesFrom
Height = 285
Left = 2220
TabIndex = 23
Text = "0"
Top = 1920
Width = 735
End
Begin VB.TextBox txtShopsTo
Height = 285
Left = 3060
TabIndex = 20
Text = "9999"
Top = 1575
Width = 735
End
Begin VB.TextBox txtShopsFrom
Height = 285
Left = 2220
TabIndex = 19
Text = "0"
Top = 1575
Width = 735
End
Begin VB.TextBox txtSpellsTo
Height = 285
Left = 3060
TabIndex = 16
Text = "9999"
Top = 1215
Width = 735
End
Begin VB.TextBox txtSpellsFrom
Height = 285
Left = 2220
TabIndex = 15
Text = "0"
Top = 1215
Width = 735
End
Begin VB.TextBox txtMonstersTo
Height = 285
Left = 3060
TabIndex = 12
Text = "9999"
Top = 855
Width = 735
End
Begin VB.TextBox txtMonstersFrom
Height = 285
Left = 2220
TabIndex = 11
Text = "0"
Top = 855
Width = 735
End
Begin VB.CheckBox chkItemsAll
Caption = "Check1"
Height = 195
Left = 1740
TabIndex = 6
Top = 540
Width = 195
End
Begin VB.TextBox txtItemsTo
Height = 285
Left = 3060
TabIndex = 8
Text = "9999"
Top = 495
Width = 735
End
Begin VB.TextBox txtItemsFrom
Height = 285
Left = 2220
TabIndex = 7
Text = "0"
Top = 495
Width = 735
End
Begin VB.CheckBox chkItems
Caption = "Items"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 5
Top = 510
Width = 1515
End
Begin VB.CheckBox chkBankbooks
Caption = "Bankbooks"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 46
Top = 4335
Width = 1515
End
Begin VB.CheckBox chkUsers
Caption = "Users"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 44
Top = 4020
Width = 1515
End
Begin VB.CheckBox chkTextblocks
Caption = "Textblocks"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 33
Top = 3000
Width = 1515
End
Begin VB.CheckBox chkMessages
Caption = "Messages"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 29
Top = 2640
Width = 1515
End
Begin VB.CheckBox chkActions
Caption = "Actions"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 180
TabIndex = 42
Top = 3720
Width = 1515
End
Begin VB.CheckBox chkRooms
Caption = "Rooms"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 37
Top = 3360
Width = 1515
End
Begin VB.CheckBox chkClasses
Caption = "Classes"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 25
Top = 2280
Width = 1515
End
Begin VB.CheckBox chkRaces
Caption = "Races"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 21
Top = 1935
Width = 1515
End
Begin VB.CheckBox chkShops
Caption = "Shops"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 17
Top = 1590
Width = 1515
End
Begin VB.CheckBox chkSpells
Caption = "Spells"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 13
Top = 1230
Width = 1515
End
Begin VB.CheckBox chkMonsters
Caption = "Monsters"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 180
TabIndex = 9
Top = 870
Width = 1515
End
Begin VB.Label Label17
Alignment = 2 'Center
Caption = "Map"
BeginProperty Font
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2820
TabIndex = 50
Top = 3960
Width = 435
End
Begin VB.Label Label16
Caption = "Delete:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 180
TabIndex = 1
Top = 240
Width = 855
End
Begin VB.Label Label15
Alignment = 2 'Center
Caption = "All"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 1620
TabIndex = 2
Top = 240
Width = 435
End
Begin VB.Label Label14
Alignment = 2 'Center
Caption = "To"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3060
TabIndex = 4
Top = 240
Width = 735
End
Begin VB.Label Label11
Alignment = 2 'Center
Caption = "From"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2220
TabIndex = 3
Top = 240
Width = 735
End
End
Begin MSComctlLib.StatusBar stsStatusBar
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 49
Top = 5760
Width = 4230
_ExtentX = 7461
_ExtentY = 450
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 4842
EndProperty
EndProperty
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Left = 120
TabIndex = 48
Top = 4920
Visible = 0 'False
Width = 3975
_ExtentX = 7011
_ExtentY = 450
_Version = 393216
Appearance = 1
End
End
Attribute VB_Name = "frmDatabaseDeleter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 0
Option Explicit
Dim nScale As Integer
Dim nScaleCount As Long
Dim bStopDelete As Boolean
Private Sub cmdClose_Click()
End Sub
Private Sub chkRoomsAll_Click()
If chkRoomsAll.Value = 1 Then
txtRoomsFrom.Enabled = False
txtRoomsTo.Enabled = False
txtRoomMap.Enabled = False
Else
txtRoomsFrom.Enabled = True
txtRoomsTo.Enabled = True
txtRoomMap.Enabled = True
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
Me.Show
Me.SetFocus
cmdCancel.SetFocus
End Sub
Private Sub chkClassesAll_Click()
If chkClassesAll.Value = 1 Then
txtClassesFrom.Enabled = False
txtClassesTo.Enabled = False
Else
txtClassesFrom.Enabled = True
txtClassesTo.Enabled = True
End If
End Sub
Private Sub chkItemsAll_Click()
If chkItemsAll.Value = 1 Then
txtItemsFrom.Enabled = False
txtItemsTo.Enabled = False
Else
txtItemsFrom.Enabled = True
txtItemsTo.Enabled = True
End If
End Sub
Private Sub chkMessagesAll_Click()
If chkMessagesAll.Value = 1 Then
txtMessagesFrom.Enabled = False
txtMessagesTo.Enabled = False
Else
txtMessagesFrom.Enabled = True
txtMessagesTo.Enabled = True
End If
End Sub
Private Sub chkMonstersAll_Click()
If chkMonstersAll.Value = 1 Then
txtMonstersFrom.Enabled = False
txtMonstersTo.Enabled = False
Else
txtMonstersFrom.Enabled = True
txtMonstersTo.Enabled = True
End If
End Sub
Private Sub chkRacesAll_Click()
If chkRacesAll.Value = 1 Then
txtRacesFrom.Enabled = False
txtRacesTo.Enabled = False
Else
txtRacesFrom.Enabled = True
txtRacesTo.Enabled = True
End If
End Sub
Private Sub chkShopsAll_Click()
If chkShopsAll.Value = 1 Then
txtShopsFrom.Enabled = False
txtShopsTo.Enabled = False
Else
txtShopsFrom.Enabled = True
txtShopsTo.Enabled = True
End If
End Sub
Private Sub chkSpellsAll_Click()
If chkSpellsAll.Value = 1 Then
txtSpellsFrom.Enabled = False
txtSpellsTo.Enabled = False
Else
txtSpellsFrom.Enabled = True
txtSpellsTo.Enabled = True
End If
End Sub
Private Sub chkTextblocksAll_Click()
If chkTextblocksAll.Value = 1 Then
txtTextblocksFrom.Enabled = False
txtTextblocksTo.Enabled = False
Else
txtTextblocksFrom.Enabled = True
txtTextblocksTo.Enabled = True
End If
End Sub
Private Sub SetRange(ByVal MaxValue As Double)
Dim nNewMax As Integer
nScale = 0
If MaxValue > MaxInt Then
If MaxValue / 2 < MaxInt Then
nScale = 2
nNewMax = MaxValue / 2
ElseIf MaxValue / 4 < MaxInt Then
nScale = 4
nNewMax = MaxValue / 4
ElseIf MaxValue / 8 < MaxInt Then
nScale = 8
nNewMax = MaxValue / 8
ElseIf MaxValue / 10 < MaxInt Then
nScale = 10
nNewMax = MaxValue / 10
Else
MaxValue = MaxInt
End If
Else
nNewMax = MaxValue
End If
nNewMax = Fix(nNewMax)
nScaleCount = 1
ProgressBar.Value = 0
ProgressBar.Min = 0
ProgressBar.Max = nNewMax
End Sub
Private Sub cmdGo_Click()
On Error GoTo error:
Dim nYesNo As Integer, nMaxValue As Long
Dim CheckboxArray(1 To 12) As Object, nFilesToDelete As Long, x As Integer
If bDisableWriting = True Then MsgBox "Writing Currently Disabled -- Check out the File menu.", vbInformation: Exit Sub
nYesNo = MsgBox("Are you sure you want to delete the selected records?", vbYesNo, "Confirm Deletion")
If nYesNo <> 6 Then Exit Sub
Call UnloadForms(Me.Name)
Call LockMenus
cmdGo.Enabled = False
fra1.Enabled = False
'cmdCancel.Enabled = False
'frmMain.Enabled = False
nFilesToDelete = 0
Set CheckboxArray(1) = chkMessages
Set CheckboxArray(2) = chkItems
Set CheckboxArray(3) = chkSpells
Set CheckboxArray(4) = chkClasses
Set CheckboxArray(5) = chkRaces
Set CheckboxArray(6) = chkShops
Set CheckboxArray(7) = chkRooms
Set CheckboxArray(8) = chkActions
Set CheckboxArray(9) = chkMonsters
Set CheckboxArray(10) = chkUsers
Set CheckboxArray(11) = chkBankbooks
Set CheckboxArray(12) = chkTextblocks
nMaxValue = CalcTotalRecords
Call SetRange(nMaxValue)
ProgressBar.Visible = True
DoEvents
bStopDelete = False
For x = 1 To UBound(CheckboxArray())
If bStopDelete Then Exit For
If CheckboxArray(x).Value = 1 Then
If x = 1 Then Call DeleteMessages
If x = 2 Then Call DeleteItems
If x = 3 Then Call DeleteSpells
If x = 4 Then Call DeleteClasses
If x = 5 Then Call DeleteRaces
If x = 6 Then Call DeleteShops
If x = 7 Then Call DeleteRooms
If x = 8 Then Call DeleteActions
If x = 9 Then Call DeleteMonsters
If x = 10 Then Call DeleteUsers
If x = 11 Then Call DeleteBankbooks
If x = 12 Then Call DeleteTextblocks
DoEvents
End If
Next
If bStopDelete Then GoTo ReEnable:
ProgressBar.Value = ProgressBar.Max
MsgBox "Deletion Complete.", vbInformation
ReEnable:
On Error Resume Next
ProgressBar.Visible = False
stsStatusBar.Panels(1).Text = ""
stsStatusBar.Panels(2).Text = ""
frmMain.Enabled = True
cmdGo.Enabled = True
fra1.Enabled = True
cmdCancel.Enabled = True
Call UnLockMenus
Exit Sub
error:
Call HandleError
Resume ReEnable:
End Sub
Private Sub cmdCancel_Click()
Dim nYesNo As Integer
If cmdGo.Enabled = False Then
nYesNo = MsgBox("Are you sure you want to cancel?", vbYesNo + vbQuestion + vbDefaultButton2)
If Not nYesNo = vbYes Then Exit Sub
cmdCancel.Enabled = False
bStopDelete = True
DoEvents
Else
Unload Me
End If
End Sub
Private Sub DeleteBankbooks()
Dim nStatus As Integer, recnum As Long
recnum = 1
stsStatusBar.Panels(1).Text = "w" & strDatCallLetters & "bank2.dat"
stsStatusBar.Panels(2).Text = recnum
nStatus = BTRCALL(BGETFIRST, BankPosBlock, BankDatabuf, Len(BankDatabuf), ByVal BankKeyBuffer, KEY_BUF_LEN, 0)
If Not nStatus = 0 Then
MsgBox "Bank, BGETFIRST, Error: " & BtrieveErrorCode(nStatus)
End If
Do While nStatus = 0
If bStopDelete Then Exit Sub
nStatus = BTRCALL(BDELETE, BankPosBlock, BankDatabuf, Len(BankDatabuf), ByVal BankKeyBuffer, KEY_BUF_LEN, 0)
nStatus = BTRCALL(BGETNEXT, BankPosBlock, BankDatabuf, Len(BankDatabuf), ByVal BankKeyBuffer, KEY_BUF_LEN, 0)
IncreaseProgressBar
recnum = recnum + 1
stsStatusBar.Panels(2).Text = recnum
If Not bUseCPU Then DoEvents
Loop
End Sub
Private Sub DeleteTextblocks()
Dim nStatus As Integer, TextblocksTo As Long, x As Long
Dim recnum As Long, TextblocksFrom As Long, y As Integer
recnum = 1
stsStatusBar.Panels(1).Text = "w" & strDatCallLetters & "text2.dat"
stsStatusBar.Panels(2).Text = recnum
nStatus = BTRCALL(BGETFIRST, TextblockPosBlock, TextblockDataBuf, TextblockMaxBufSize, ByVal TextblockKeyBuffer, KEY_BUF_LEN, 0)
If Not nStatus = 0 Then
MsgBox "GETFIRST Textblock, Error: " & BtrieveErrorCode(nStatus)
Exit Sub
End If
If chkTextblocksAll.Value <> 1 Then GoTo range:
Do While nStatus = 0
If bStopDelete Then Exit Sub
nStatus = BTRCALL(BDELETE, TextblockPosBlock, TextblockDataBuf, TextblockMaxBufSize, ByVal TextblockKeyBuffer, KEY_BUF_LEN, 0)
nStatus = BTRCALL(BGETNEXT, TextblockPosBlock, TextblockDataBuf, TextblockMaxBufSize, ByVal TextblockKeyBuffer, KEY_BUF_LEN, 0)
IncreaseProgressBar
recnum = recnum + 1
stsStatusBar.Panels(2).Text = recnum
If Not bUseCPU Then DoEvents
Loop
Exit Sub
range:
TextblocksFrom = Val(txtTextblocksFrom.Text)
TextblocksTo = Val(txtTextblocksTo.Text)
TextblockKey.PartNum = 0
TextblockKey.Number = TextblocksFrom
nStatus = BTRCALL(BGETEQUAL, TextblockPosBlock, TextblockDataBuf, Len(TextblockDataBuf), TextblockKey, KEY_BUF_LEN, 0)
'Do While nStatus = 0
' If bStopDelete Then Exit Do
' nStatus = BTRCALL(BDELETE, TextblockPosBlock, TextblockDataBuf, Len(TextblockDataBuf), ByVal TextblockKeyBuffer, KEY_BUF_LEN, 0)
' nStatus = BTRCALL(BGETNEXT, TextblockPosBlock, TextblockDataBuf, TextblockMaxBufSize, ByVal TextblockKeyBuffer, KEY_BUF_LEN, 0)
'
' If nStatus = 0 Then
' TextblockRowToStruct TextblockDataBuf.buf
' If TextblockRec.Number > TextblocksTo Then Exit Do
'
' Call IncreaseProgressBar
' stsStatusBar.Panels(2).Text = TextblockRec.Number
' End If
'
' If Not bUseCPU Then DoEvents
'Loop
For x = TextblocksFrom To TextblocksTo
TextblockKey.Number = x
For y = 0 To 20
If bStopDelete Then Exit Sub
TextblockKey.PartNum = y
nStatus = BTRCALL(BGETEQUAL, TextblockPosBlock, TextblockDataBuf, Len(TextblockDataBuf), TextblockKey, KEY_BUF_LEN, 0)
If nStatus = 0 Then
nStatus = BTRCALL(BDELETE, TextblockPosBlock, TextblockDataBuf, Len(TextblockDataBuf), ByVal TextblockKeyBuffer, KEY_BUF_LEN, 0)
Else
'Exit For
End If
Next y
Call IncreaseProgressBar
stsStatusBar.Panels(2).Text = x
If Not bUseCPU Then DoEvents
Next x
End Sub
Private Sub DeleteMessages()
Dim nStatus As Integer, recnum As Long, MessagesTo As Long, x As Long, MessagesFrom As Long
recnum = 1
stsStatusBar.Panels(1).Text = "w" & strDatCallLetters & "msg2.dat"
stsStatusBar.Panels(2).Text = recnum
nStatus = BTRCALL(BGETFIRST, MessagePosBlock, Messagedatabuf, Len(Messagedatabuf), ByVal MessageKeyBuffer, KEY_BUF_LEN, 0)
If Not nStatus = 0 Then
MsgBox "GETFIRST Messages, Error: " & BtrieveErrorCode(nStatus)
Exit Sub
End If
If chkMessagesAll.Value <> 1 Then GoTo range:
Do While nStatus = 0
If bStopDelete Then Exit Sub
nStatus = BTRCALL(BDELETE, MessagePosBlock, Messagedatabuf, Len(Messagedatabuf), ByVal MessageKeyBuffer, KEY_BUF_LEN, 0)
nStatus = BTRCALL(BGETNEXT, MessagePosBlock, Messagedatabuf, Len(Messagedatabuf), ByVal MessageKeyBuffer, KEY_BUF_LEN, 0)
IncreaseProgressBar
recnum = recnum + 1
stsStatusBar.Panels(2).Text = recnum
If Not bUseCPU Then DoEvents
Loop
Exit Sub
range:
MessagesFrom = Val(txtMessagesFrom.Text)
MessagesTo = Val(txtMessagesTo.Text)
For x = MessagesFrom To MessagesTo
If bStopDelete Then Exit Sub
nStatus = BTRCALL(BGETEQUAL, MessagePosBlock, Messagedatabuf, Len(Messagedatabuf), x, KEY_BUF_LEN, 0)
If nStatus = 0 Then
nStatus = BTRCALL(BDELETE, MessagePosBlock, Messagedatabuf, Len(Messagedatabuf), ByVal MessageKeyBuffer, KEY_BUF_LEN, 0)
End If
IncreaseProgressBar
stsStatusBar.Panels(2).Text = x
If Not bUseCPU Then DoEvents
Next x
End Sub
Private Sub DeleteItems()
Dim nStatus As Integer, recnum As Long, ItemsFrom As Long, ItemsTo As Long, x As Long