-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFRMTRANS.frm
More file actions
316 lines (273 loc) · 8.98 KB
/
FRMTRANS.frm
File metadata and controls
316 lines (273 loc) · 8.98 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
VERSION 5.00
Begin VB.Form FRMTRAN
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
BorderStyle = 3 'Fixed Dialog
Caption = "远程协助"
ClientHeight = 7935
ClientLeft = 45
ClientTop = 330
ClientWidth = 11925
Icon = "FRMTRANS.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 529
ScaleMode = 3 'Pixel
ScaleWidth = 795
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox PO
Align = 1 'Align Top
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H00231C09&
BorderStyle = 0 'None
Height = 1455
Left = 0
ScaleHeight = 1455
ScaleWidth = 11925
TabIndex = 1
Top = 0
Width = 11925
Begin ICEE.ICEE_COMMAND COK
Height = 615
Left = 2760
TabIndex = 9
Top = 600
Width = 1815
_ExtentX = 3201
_ExtentY = 1085
End
Begin VB.OptionButton OptIsServer
BackColor = &H00231C09&
Caption = "客户机(&C)"
ForeColor = &H00FFFFFF&
Height = 360
Index = 0
Left = 240
MaskColor = &H00FFFFFF&
TabIndex = 6
Top = 120
Width = 1200
End
Begin VB.OptionButton OptIsServer
BackColor = &H00231C09&
Caption = "服务器(&S)"
ForeColor = &H00FFFFFF&
Height = 360
Index = 1
Left = 1440
MaskColor = &H00FFFFFF&
TabIndex = 5
Top = 120
Width = 1200
End
Begin VB.TextBox TxtIP
Alignment = 2 'Center
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 270
Left = 960
TabIndex = 4
Text = "127.0.0.1"
Top = 600
Width = 1695
End
Begin VB.TextBox TxtPort
Alignment = 2 'Center
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 270
Index = 0
Left = 960
TabIndex = 3
Text = "1503"
Top = 960
Width = 855
End
Begin VB.TextBox TxtPort
Alignment = 2 'Center
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 270
Index = 1
Left = 1800
TabIndex = 2
Text = "1312"
Top = 960
Width = 855
End
Begin ICEE.ICEE_COMMAND CUN
Height = 615
Left = 4560
TabIndex = 10
Top = 600
Width = 1815
_ExtentX = 3201
_ExtentY = 1085
End
Begin VB.Label LblIP
BackStyle = 0 'Transparent
Caption = "IP地址:"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 8
Top = 600
Width = 720
End
Begin VB.Label LblPort
BackStyle = 0 'Transparent
Caption = "端口号:"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 7
Top = 960
Width = 720
End
End
Begin ICEE.ICEE_NET NetGIFTran1
Height = 6495
Left = 0
TabIndex = 0
Top = 1440
Visible = 0 'False
Width = 11895
_ExtentX = 7858
_ExtentY = 1931
End
End
Attribute VB_Name = "FRMTRAN"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function SetStretchBltMode Lib "gdi32" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long
Private Const HALFTONE = 4
Private mOldTime As Currency
Private Sub Form_Load()
COK.SETTXT "连 接"
CUN.SETTXT "关 闭"
End Sub
Private Sub Form_Paint()
NetGIFTran1.Draw Me.hdc, 0, 0, Me.ScaleWidth, Me.ScaleHeight
End Sub
Private Sub Form_Unload(Cancel As Integer)
NetGIFTran1.CloseConnect
End Sub
Private Sub NetGIFTran1_CloseConnect()
Call UpdataUI
End Sub
Private Sub NetGIFTran1_OnPictureArrival()
Dim CurTime As Currency
CurTime = GetCurTime()
Me.Caption = App.Title & ": " & vbTab & "间隔:" & Format$(CurTime - mOldTime, "###,###,###,##0.0000") & "ms"
mOldTime = CurTime
Me.Refresh
End Sub
Private Sub NetGIFTran1_OnQueryPicture()
'Debug.Print "NetGIFTran1_OnQueryPicture"
Static OldTime As Currency
Dim CurTime As Currency
Const SampTimeDis = 1000 '采样间隔(ms)
If NetGIFTran1.CurClients > 1 Then '只有客户数大于1时才控制采样间隔
CurTime = GetCurTime()
If OldTime + SampTimeDis > CurTime Then '未到时间
Exit Sub
End If
OldTime = CurTime
End If
Dim hDCScr As Long
hDCScr = GetDC(0)
If hDCScr Then
Me.MousePointer = vbHourglass
Call NetGIFTran1.SetBitmap(hDCScr, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY)
Me.MousePointer = vbDefault
Call ReleaseDC(0, hDCScr)
Me.Refresh
End If
End Sub
'更新界面
Public Sub UpdataUI()
Dim fConnect As Boolean
With Me.NetGIFTran1
If sckClosing = .State Then .CloseConnect
fConnect = (.State <> sckClosed)
OptIsServer(0).Enabled = Not fConnect
OptIsServer(1).Enabled = Not fConnect
TxtIP.Enabled = Not fConnect
TxtPort(0).Enabled = Not fConnect
TxtPort(1).Enabled = Not fConnect
Dim TempStr As String
If fConnect Then
TempStr = .RemoteHostIP
If Len(TempStr) = 0 Then TempStr = .RemoteHost
Else
TempStr = .LocalIP
End If
If Len(TempStr) Then TxtIP.Text = TempStr
OptIsServer(0).Value = Not .IsServer
OptIsServer(1).Value = .IsServer
'Debug.Print .IsServer
If fConnect Then
If .IsServer Then
TxtPort(0).Text = CStr(.LocalPort)
TxtPort(1).Text = CStr(.RemotePort)
Else
TxtPort(0).Text = CStr(.RemotePort)
TxtPort(1).Text = CStr(.LocalPort)
End If
End If
End With
End Sub
Private Sub CUN_Click()
With NetGIFTran1
If .State <> sckClosed Then '已连结
Call .CloseConnect
End If
End With
Call UpdataUI
End Sub
Private Sub COK_Click()
With NetGIFTran1
If .State = sckClosed Then '未连结
.IsServer = OptIsServer(1).Value
If .IsServer Then
.LocalPort = Val(TxtPort(0).Text)
.RemotePort = Val(TxtPort(1).Text)
Else
.RemotePort = Val(TxtPort(0).Text)
.LocalPort = 0 'Val(TxtPort(1).Text)
.RemoteHost = Trim(TxtIP.Text)
End If
If .Connect() = False Then Call SHOWWRONG("无法连结!", 2)
End If
End With
Call UpdataUI
End Sub
Private Sub Form_Activate()
Call UpdataUI
End Sub
Private Sub TxtIP_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKey0 To vbKey9
Case vbKeyBack
Case 46 'Asc(".")=46
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TxtPort_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case KeyAscii
Case vbKey0 To vbKey9
Case vbKeyBack
Case Else
KeyAscii = 0
End Select
End Sub