-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfrmMain.frm
More file actions
2050 lines (1927 loc) · 88.9 KB
/
frmMain.frm
File metadata and controls
2050 lines (1927 loc) · 88.9 KB
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 = "{A8E5842E-102B-4289-9D57-3B3F5B5E15D3}#12.0#0"; "Controls.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmMain
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "远程控制"
ClientHeight = 4596
ClientLeft = 48
ClientTop = 372
ClientWidth = 8424
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4596
ScaleWidth = 8424
StartUpPosition = 2 '屏幕中心
Begin VB.Timer tmrCalcPerSecond
Enabled = 0 'False
Interval = 1000
Left = 3120
Top = 3360
End
Begin MSWinsockLib.Winsock wsFile
Left = 7920
Top = 3960
_ExtentX = 593
_ExtentY = 593
_Version = 393216
End
Begin VB.Timer tmrChangeIcon
Interval = 10
Left = 7800
Top = 480
End
Begin VB.Timer tmrBlockInput
Enabled = 0 'False
Interval = 10
Left = 2520
Top = 3360
End
Begin VB.ListBox lstPassword
Height = 264
ItemData = "frmMain.frx":0CCA
Left = 2400
List = "frmMain.frx":0CCC
TabIndex = 21
Top = 4200
Visible = 0 'False
Width = 372
End
Begin VB.Timer tmrForceRefresh
Enabled = 0 'False
Interval = 10
Left = 1920
Top = 3360
End
Begin VB.DriveListBox Drive
Height = 312
Left = 240
TabIndex = 20
Top = 4200
Visible = 0 'False
Width = 270
End
Begin VB.DirListBox Dir
Height = 312
Left = 720
TabIndex = 19
Top = 4200
Visible = 0 'False
Width = 375
End
Begin VB.FileListBox File
Height = 288
Hidden = -1 'True
Left = 1320
Pattern = "*"
System = -1 'True
TabIndex = 18
Top = 4200
Visible = 0 'False
Width = 375
End
Begin VB.ListBox lstClipboard
Height = 264
ItemData = "frmMain.frx":0CCE
Left = 1920
List = "frmMain.frx":0CD0
TabIndex = 17
Top = 4200
Visible = 0 'False
Width = 375
End
Begin VB.PictureBox picRefresh
AutoRedraw = -1 'True
DrawWidth = 100
Height = 252
Left = 1320
ScaleHeight = 204
ScaleWidth = 324
TabIndex = 15
Top = 3840
Visible = 0 'False
Width = 372
End
Begin VB.ListBox lstTemp
Height = 264
ItemData = "frmMain.frx":0CD2
Left = 1920
List = "frmMain.frx":0CD4
TabIndex = 16
Top = 3840
Visible = 0 'False
Width = 372
End
Begin VB.Timer tmrReturn
Enabled = 0 'False
Interval = 2000
Left = 1320
Top = 3360
End
Begin VB.Timer tmrTimeOut
Enabled = 0 'False
Interval = 5000
Left = 720
Top = 3360
End
Begin VB.Timer tmrRetry
Enabled = 0 'False
Interval = 3000
Left = 120
Top = 3360
End
Begin MSWinsockLib.Winsock wsPic
Left = 6960
Top = 3960
_ExtentX = 593
_ExtentY = 593
_Version = 393216
End
Begin VB.PictureBox picBack
BackColor = &H00C86400&
BorderStyle = 0 'None
Height = 735
Left = 0
ScaleHeight = 732
ScaleWidth = 8412
TabIndex = 13
Top = 0
Width = 8415
Begin VB.Image imgAbout
Height = 360
Left = 8040
Picture = "frmMain.frx":0CD6
Stretch = -1 'True
ToolTipText = "关于"
Top = 0
Width = 360
End
Begin VB.Image imgSettings
Height = 360
Left = 7620
Picture = "frmMain.frx":19A0
Stretch = -1 'True
ToolTipText = "设置"
Top = 0
Width = 360
End
Begin VB.Label labTip
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "远程控制"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 216
Index = 5
Left = 720
TabIndex = 14
Top = 240
Width = 912
End
Begin VB.Image imgMainIcon
Height = 500
Left = 120
Picture = "frmMain.frx":266A
Stretch = -1 'True
Top = 120
Width = 500
End
End
Begin XtremeSuiteControls.CheckBox chkAllow
Height = 375
Left = 240
TabIndex = 6
Top = 3000
Width = 3615
_Version = 786432
_ExtentX = 6376
_ExtentY = 661
_StockProps = 79
Caption = "允许远程控制"
Appearance = 4
Value = 1
End
Begin XtremeSuiteControls.FlatEdit edLocalIP
Height = 375
Left = 1440
TabIndex = 4
Top = 1440
Width = 2055
_Version = 786432
_ExtentX = 3625
_ExtentY = 661
_StockProps = 77
Text = "666.666.666.666"
BackColor = 16777215
Locked = -1 'True
Appearance = 6
FlatStyle = -1 'True
UseVisualStyle = -1 'True
RightToLeft = -1 'True
End
Begin XtremeSuiteControls.PushButton cmdConnect
Height = 495
Left = 4320
TabIndex = 3
Top = 3720
Width = 2535
_Version = 786432
_ExtentX = 4471
_ExtentY = 873
_StockProps = 79
Caption = "点我连接咯!"
ForeColor = 16777215
BackColor = 16416003
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Appearance = 3
DrawFocusRect = 0 'False
ImageGap = 1
End
Begin XtremeSuiteControls.RadioButton optControl
Height = 372
Left = 4320
TabIndex = 1
ToolTipText = "以远程控制方式连接对方"
Top = 2520
Width = 3852
_Version = 786432
_ExtentX = 6800
_ExtentY = 661
_StockProps = 79
Caption = "远程控制模式"
Appearance = 4
Value = -1 'True
End
Begin XtremeSuiteControls.ComboBox comIP
Height = 360
Left = 4320
TabIndex = 0
Top = 1800
Width = 3855
_Version = 786432
_ExtentX = 6800
_ExtentY = 635
_StockProps = 77
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BackColor = 16777215
Appearance = 6
UseVisualStyle = -1 'True
AutoComplete = -1 'True
DropDownItemCount= 5
End
Begin XtremeSuiteControls.RadioButton optFile
Height = 375
Left = 4320
TabIndex = 2
ToolTipText = "以文件传输方式连接对方"
Top = 3000
Width = 3855
_Version = 786432
_ExtentX = 6800
_ExtentY = 661
_StockProps = 79
Caption = "文件传输模式"
Appearance = 4
End
Begin XtremeSuiteControls.FlatEdit edPassword
Height = 375
Left = 1440
TabIndex = 5
Top = 2160
Width = 2055
_Version = 786432
_ExtentX = 3625
_ExtentY = 661
_StockProps = 77
Text = "123456"
BackColor = 16777215
Locked = -1 'True
Appearance = 6
FlatStyle = -1 'True
UseVisualStyle = -1 'True
RightToLeft = -1 'True
End
Begin MSWinsockLib.Winsock wsMessage
Left = 7440
Top = 3960
_ExtentX = 593
_ExtentY = 593
_Version = 393216
End
Begin VB.Image imgAbout1
Height = 360
Left = 7680
Picture = "frmMain.frx":3334
Stretch = -1 'True
Top = 1080
Visible = 0 'False
Width = 360
End
Begin VB.Image imgSettings1
Height = 384
Left = 6960
Picture = "frmMain.frx":3FFE
Top = 1080
Visible = 0 'False
Width = 384
End
Begin VB.Image imgSettings2
Height = 384
Left = 7080
Picture = "frmMain.frx":4CC8
Top = 960
Visible = 0 'False
Width = 384
End
Begin VB.Image imgSettings3
Height = 384
Left = 7200
Picture = "frmMain.frx":5992
Top = 840
Visible = 0 'False
Width = 384
End
Begin VB.Image imgAbout2
Height = 384
Left = 7800
Picture = "frmMain.frx":665C
Top = 960
Visible = 0 'False
Width = 384
End
Begin VB.Image imgAbout3
Height = 384
Left = 7920
Picture = "frmMain.frx":7326
Top = 840
Visible = 0 'False
Width = 384
End
Begin XtremeSuiteControls.TrayIcon Tray
Left = 3960
Top = 4080
_Version = 786432
_ExtentX = 339
_ExtentY = 339
_StockProps = 16
Text = "远程控制"
Picture = "frmMain.frx":7FF0
End
Begin VB.Image imgCopy
Height = 360
Index = 1
Left = 3600
Picture = "frmMain.frx":8CCA
Stretch = -1 'True
ToolTipText = "复制您的密码到剪贴板"
Top = 2160
Width = 360
End
Begin VB.Image imgCopy1
Height = 360
Left = 2880
Picture = "frmMain.frx":9434
Stretch = -1 'True
Top = 3960
Visible = 0 'False
Width = 360
End
Begin VB.Image imgCopy3
Height = 288
Left = 3600
Picture = "frmMain.frx":9B9E
Top = 3960
Visible = 0 'False
Width = 288
End
Begin VB.Image imgCopy2
Height = 288
Left = 3240
Picture = "frmMain.frx":A308
Top = 3960
Visible = 0 'False
Width = 288
End
Begin VB.Image imgCopy
Height = 360
Index = 0
Left = 3600
Picture = "frmMain.frx":AA72
Stretch = -1 'True
ToolTipText = "复制您的IP到剪贴板"
Top = 1440
Width = 360
End
Begin VB.Label labState
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "无连接"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 180
Left = 480
TabIndex = 12
Top = 3960
Width = 540
End
Begin VB.Shape shpState
BorderColor = &H00FFFFC0&
FillColor = &H0000FF00&
FillStyle = 0 'Solid
Height = 195
Left = 240
Shape = 3 'Circle
Top = 3960
Width = 195
End
Begin VB.Line Line
BorderColor = &H00C0C000&
Index = 2
X1 = 4080
X2 = 0
Y1 = 3720
Y2 = 3720
End
Begin VB.Label labTip
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "您的IP"
ForeColor = &H00FFFFFF&
Height = 210
Index = 3
Left = 480
TabIndex = 10
Top = 1500
Width = 630
End
Begin VB.Image imgBack
Height = 360
Index = 1
Left = 240
Picture = "frmMain.frx":B1DC
Stretch = -1 'True
Top = 1440
Width = 1095
End
Begin VB.Label labTip
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "随机密码"
ForeColor = &H00FFFFFF&
Height = 210
Index = 4
Left = 360
TabIndex = 11
Top = 2205
Width = 840
End
Begin VB.Line Line
BorderColor = &H00C0C000&
Index = 1
X1 = 3960
X2 = 120
Y1 = 2040
Y2 = 2040
End
Begin VB.Line Line
BorderColor = &H00C0C000&
Index = 0
X1 = 4080
X2 = 4080
Y1 = 840
Y2 = 4560
End
Begin VB.Label labTip
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "允许远程控制"
BeginProperty Font
Name = "宋体"
Size = 15.6
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 1
Left = 240
TabIndex = 9
Top = 840
Width = 1890
End
Begin VB.Label labTip
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "对方IP地址"
ForeColor = &H00404040&
Height = 210
Index = 2
Left = 4320
TabIndex = 8
Top = 1440
Width = 1050
End
Begin VB.Label labTip
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "控制远程电脑"
BeginProperty Font
Name = "宋体"
Size = 15.6
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 0
Left = 4320
TabIndex = 7
Top = 840
Width = 1890
End
Begin VB.Image imgBack
Height = 360
Index = 2
Left = 240
Picture = "frmMain.frx":B67C
Stretch = -1 'True
Top = 2160
Width = 1095
End
Begin VB.Menu mnuPopup
Caption = "PopupMenu"
Visible = 0 'False
Begin VB.Menu mnuShowWindow
Caption = "显示主窗体(&S)"
End
Begin VB.Menu mnuExit
Caption = "退出(&E)"
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'================================================================
' /\
' / \
' |屠|
' |B |
' |U |
' |G |
' |宝|
' |刀| __
' ,_| |_, / )
' (Oo / _I_
' +\ \ ||· ·|
' \ \||_ 0→
' \/.:.\- \
' |.:. /-----\
' |___|::oOo::|
' / |:<_T_>:|
' | |::oOo::|
' | \-----/
' |:_|__|
' |===|==|
' | | |
' |& \ \
' *( , `'-.'-.
' `"`"""""`""`
'
' BUG挡路必死!
'================================================================
'图像端口:20234
'消息端口:20235
'文件端口:20236
'----------------------
'未连接:红色
'监听中:绿色
'有连接:蓝色
'正在连接:黄色
'----------------------
'通用数据流分割:{S}
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Const BI_RGB = 0&
Private Const DIB_RGB_COLORS = 0 'color table in RGBs
Private Type BITMAPINFOHEADER '40 bytes
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors As RGBQUAD
End Type
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateDIBSection Lib "gdi32" (ByVal hdc As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByRef pointer As Long, ByVal handle As Long, ByVal dw As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetCursor Lib "user32" () As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function CompMemory Lib "ntdll.dll" Alias "RtlCompareMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'=========================================================================
'以下为zlib压缩及用到的函数
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Declare Function Compress Lib "zlib.dll" Alias "compress" (dest As Any, destLen As Any, src As Any, ByVal srcLen As Long) As Long
Private Declare Function uncompress Lib "zlib.dll" (dest As Any, destLen As Any, src As Any, ByVal srcLen As Long) As Long
Private Const OFFSET As Long = &H8
'键盘控制
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
'========
Dim W As Long, H As Long, M As Long
Dim x, y As Long, dwCurrentThreadID1 As Long
Dim J As Byte, Hei As Byte, g As Long
Dim T As Boolean
Dim bmpLen As Long, F As Byte
Dim CapName As String
Dim sdc As Long
Dim iBitmap1 As Long, iDC1 As Long, opeinter1 As Long
Dim iBitmap2 As Long, iDC2 As Long, opeinter2 As Long
Dim iBitmap3 As Long, iDC3 As Long, opeinter3 As Long
Dim iBitmap4 As Long, iDC4 As Long, opeinter4 As Long
Dim r1() As Byte
Dim XH As Boolean
'========================================================
Dim bMouseDown As Boolean '是否按下鼠标
Dim bTray As Boolean '当前是否处于托盘区状态
Public IsUpload As Boolean '对方是否为上传状态 【True:上传 False:下载】
Public recBytes As Long '接收到的文件数据字节数
Public oldBytes As Long '上一秒接收到的文件数据字节数
Public BytesPerSec As Long '每一秒的字节数
Public lSent As Long, oldSent As Long '已发送的字节数 上一秒发送的字节数
Public FileRec As Integer '成功接收的文件数
Public FileSent As Integer '成功发送的文件数
Dim EachFile() As String '文件列表里的每个文件
Public FileList As String '待发送的文件列表
Public CurrentFile As Integer '当前文件的Index
Public TotalFiles As Integer '待发送的文件总数
Public CurrentSize As Long '当前打开文件的大小
Dim dSendTemp() As Byte '准备发送的文件
'========================================================================================================
Public Function NextFile() As Boolean '下一文件过程
CurrentFile = CurrentFile + 1
If CurrentFile > UBound(EachFile) - 1 Then '如果序号超出文件总数
NextFile = False
Exit Function
End If
'---------------------------
Do While LoadFile(EachFile(CurrentFile)) = False '如果读取文件错误就继续下一个文件
CurrentFile = CurrentFile + 1 '文件序号 + 1
If CurrentFile > UBound(EachFile) - 1 Then '如果序号超出文件总数
NextFile = False
Exit Function
End If
Loop
NextFile = True
End Function
Public Function LoadFile(sFileName As String) As Boolean '加载文件过程
On Error Resume Next
'-----------------------------------
LoadFile = True
Open sFileName For Binary As #1 '打开文件
If Err.Number <> 0 Then '文件不存在
Close #1 '关闭文件
LoadFile = False
Exit Function
End If
'--------------------
ReDim dSendTemp(LOF(1)) '分配内存
CurrentSize = LOF(1)
If Err.Number <> 0 Then '文件过大
MsgBox "文件过大:" & sFileName
LoadFile = False
Exit Function
End If
If UBound(dSendTemp) = 0 Then '如果读取到的字节数为0
Close #1 '关闭文件
LoadFile = False
Exit Function
End If
Get #1, , dSendTemp '读取文件
Close #1
lSent = 0 '清空文件发送字节数
oldSent = 0
End Function
Sub SendLoop() '循环发送屏幕过程
Do While XH '不要看到Do就怕。。。对方接收完才会发送下一张滴~所以这个不是死循环~
Call Send_data
Sleep 1
If bKeepSending = False Then
Exit Do
End If
Loop
End Sub
Private Function MyGetCursor() As Long '绘制鼠标位置
Dim hWindow As Long, dwThreadID As Long, dwCurrentThreadID As Long
Dim Pt As POINTAPI
GetCursorPos Pt
x = Pt.x - 6 '为什么要减去6呢?因为获取到的指针位置会有所偏移,减去6可以在一定程度上矫正位置,但是还是不准...
y = Pt.y - 6 - g
hWindow = WindowFromPoint(Pt.x, Pt.y)
dwThreadID = GetWindowThreadProcessId(hWindow, 0)
dwCurrentThreadID = GetCurrentThreadId
If dwCurrentThreadID1 <> dwThreadID Then
If AttachThreadInput(dwCurrentThreadID, dwCurrentThreadID1, False) Then
End If
dwCurrentThreadID1 = dwThreadID
If AttachThreadInput(dwCurrentThreadID, dwCurrentThreadID1, True) Then
MyGetCursor = GetCursor
End If
Else
MyGetCursor = GetCursor
End If
End Function
Private Sub Send_data() '发送屏幕主过程
Dim Bmp As BITMAP
Dim hdc As Long, BD As Long
Dim Tpicture As Boolean
'===========
Dim b As String
Dim a() As Byte
'=======
If g = 0 Then BitBlt iDC3, 0, 0, W, H * F, sdc, 0, 0, vbSrcCopy '3DC内容
If g = 0 Then DrawIcon iDC3, x, y, MyGetCursor
'!注3和1、2不能搞反
'================================
BitBlt iDC1, 0, 0, W, H, iDC3, 0, g, vbSrcCopy '1DC内容
'================
BitBlt iDC2, 0, 0, W, H, iDC4, 0, g, vbSrcCopy '2DC内容
'================================
'================================
BD = CompMemory(ByVal opeinter1, ByVal opeinter2, bmpLen) '屏幕对比
Tpicture = CBool(BD = bmpLen)
'================================
If Not Tpicture Then '如果屏幕内容发生了变化
XH = False
BitBlt iDC4, 0, g, W, H, iDC1, 0, 0, vbSrcCopy '4DC内容
'===============
BitBlt iDC1, 0, 0, W, H, iDC2, 0, 0, vbSrcInvert '扫描
'===============
ReDim r1(bmpLen) As Byte '按图像数据实际的大小分配缓冲区
CopyMemory r1(0), ByVal opeinter1, bmpLen
If bCompress = True Then
CompressByte r1 '压缩
End If
'======================= [头]对数据进行整理
b = Format(UBound(r1), "00000000")
Mid$(b, 1, 1) = J
If J = 0 Then Mid$(b, 1, 1) = 9
a = StrConv(b, vbFromUnicode) '字符串转换为字节数组
Me.wsPic.SendData a
'=====
End If
J = J + 1
If J >= F Then J = 0
g = J * H
End Sub
Private Sub SendDat() '发送空图像让对方准备开始接收
XH = True
Me.wsPic.SendData r1
End Sub
Function CompressByte(ByteArray() As Byte) '数据压缩过程
Dim BufferSize As Long
Dim TempBuffer() As Byte
BufferSize = UBound(ByteArray) + 1
BufferSize = BufferSize + (BufferSize * 0.01) + 12
ReDim TempBuffer(BufferSize)
CompressByte = (Compress(TempBuffer(0), BufferSize, ByteArray(0), UBound(ByteArray) + 1) = 0)
Call CopyMemory(ByteArray(0), CLng(UBound(ByteArray) + 1), OFFSET)
ReDim Preserve ByteArray(0 To BufferSize + OFFSET - 1)
CopyMemory ByteArray(OFFSET), TempBuffer(0), BufferSize
End Function
Private Sub Del_dc() '释放内存DC过程
ReleaseDC 0, sdc
DeleteDC iDC2
DeleteObject iBitmap2
DeleteDC iDC1
DeleteObject iBitmap1
DeleteDC iDC3
DeleteObject iBitmap3
DeleteDC iDC4
DeleteObject iBitmap4
End Sub
Private Sub sLoadf() '加载内存DC过程,这里是绑定位图操作
Dim bi24BitInfo As BITMAPINFO
With bi24BitInfo.bmiHeader '设置位图属性
.biBitCount = 16
.biCompression = BI_RGB
.biPlanes = 1
.biSize = Len(bi24BitInfo.bmiHeader)
.biWidth = W
.biHeight = H
End With
'======= '绑定到位图
iDC1 = CreateCompatibleDC(0) '1
iBitmap1 = CreateDIBSection(iDC1, bi24BitInfo, DIB_RGB_COLORS, opeinter1, ByVal 0&, ByVal 0&)
SelectObject iDC1, iBitmap1
'=======
iDC2 = CreateCompatibleDC(0) '2
iBitmap2 = CreateDIBSection(iDC2, bi24BitInfo, DIB_RGB_COLORS, opeinter2, ByVal 0&, ByVal 0&)
SelectObject iDC2, iBitmap2
'=======
End Sub
Private Sub SLoad() '同样是加载内存DC的过程,这里是加载操作
Dim bi24BitInfo1 As BITMAPINFO
Dim scrw, scrh As Single
'=======
sdc = GetDC(0)
With bi24BitInfo1.bmiHeader
.biBitCount = 16
.biCompression = BI_RGB
.biPlanes = 1
.biSize = Len(bi24BitInfo1.bmiHeader)
.biWidth = W
.biHeight = H * F
End With
'=======
iDC3 = CreateCompatibleDC(0) '3内存dc
iBitmap3 = CreateDIBSection(iDC3, bi24BitInfo1, DIB_RGB_COLORS, opeinter3, ByVal 0&, ByVal 0&)
SelectObject iDC3, iBitmap3
'=======
'=======
iDC4 = CreateCompatibleDC(0) '4内存dc
iBitmap4 = CreateDIBSection(iDC4, bi24BitInfo1, DIB_RGB_COLORS, opeinter4, ByVal 0&, ByVal 0&)
SelectObject iDC4, iBitmap4
'=======
'=======
Dim sdc1 As Long
sdc1 = GetDC(0)
BitBlt iDC4, 0, 0, W, H * F, sdc1, 0, 0, vbSrcCopy '4DC内容
DrawIcon iDC4, x, y, MyGetCursor
ReleaseDC 0, sdc1
'======
Call sLoadf '加载完后进行绑定操作
End Sub
Private Sub New_dc() '创建新位图处理
'===========
Dim b As String
Dim a() As Byte
'================
ReDim r1(bmpLen * F) As Byte '按图像数据实际的大小分配缓冲区
CopyMemory r1(0), ByVal opeinter4, bmpLen * F
'======================= [头]对数据进行整理
If bCompress = True Then
CompressByte r1 '压缩
End If
b = Format(UBound(r1), "00000000")
Mid$(b, 1, 1) = J
If J = 0 Then Mid$(b, 1, 1) = 9
a = StrConv(b, vbFromUnicode) '字符串转换为字节数组
Me.wsPic.SendData a
End Sub
'========================================================================
Private Sub cmdConnect_Click()
Me.shpState.FillColor = vbYellow '更改状态
Me.labState.Caption = "正在连接..."
If Me.optControl.Value = True Then '远控模式
frmRemoteControl.wsPicture.Close