forked from chrrg/glut-network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.frm
More file actions
405 lines (380 loc) · 11.7 KB
/
Form1.frm
File metadata and controls
405 lines (380 loc) · 11.7 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
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "桂林理工大学-校园网上网客户端3.0"
ClientHeight = 5070
ClientLeft = 45
ClientTop = 390
ClientWidth = 6555
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5070
ScaleWidth = 6555
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 6000
Top = 4200
End
Begin VB.Frame Frame1
BorderStyle = 0 'None
Height = 495
Left = 1680
TabIndex = 15
Top = 2640
Width = 3135
Begin VB.OptionButton Option2
Caption = "屏风校区"
Height = 495
Index = 1
Left = 2040
TabIndex = 17
Top = 0
Width = 1335
End
Begin VB.OptionButton Option2
Caption = "雁山校区"
Height = 255
Index = 0
Left = 240
TabIndex = 16
Top = 120
Width = 1215
End
End
Begin VB.OptionButton Option1
Caption = "联通"
Height = 255
Index = 3
Left = 4680
TabIndex = 7
Top = 2400
Width = 975
End
Begin VB.OptionButton Option1
Caption = "移动"
Height = 255
Index = 2
Left = 3480
TabIndex = 6
Top = 2400
Width = 975
End
Begin VB.OptionButton Option1
Caption = "电信"
Height = 255
Index = 1
Left = 2280
TabIndex = 5
Top = 2400
Width = 975
End
Begin VB.OptionButton Option1
Caption = "校园网"
Height = 255
Index = 0
Left = 1080
TabIndex = 4
Top = 2400
Value = -1 'True
Width = 975
End
Begin VB.CheckBox Check2
Caption = "打开时自动登录"
Height = 375
Left = 3600
TabIndex = 9
Top = 3120
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "关于"
Height = 615
Left = 3360
TabIndex = 3
Top = 3960
Width = 1575
End
Begin VB.CheckBox Check1
Caption = "记住账号密码"
Height = 375
Left = 1440
TabIndex = 8
Top = 3120
Width = 1695
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 1
Top = 1800
Width = 4215
End
Begin VB.CommandButton Command1
Caption = "登录"
Height = 615
Left = 1680
TabIndex = 2
Top = 3960
Width = 1575
End
Begin VB.TextBox Text1
Height = 495
Left = 1560
TabIndex = 0
Top = 1200
Width = 4215
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "如果未绑定运营商,请选择校园网"
ForeColor = &H00808000&
Height = 180
Left = 1920
TabIndex = 14
Top = 3600
Width = 3180
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "桂林理工大学-校园网登录"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 12
Top = 480
Width = 4695
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "校园网密码:"
Height = 375
Left = 480
TabIndex = 11
Top = 1920
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "校园网账号:"
Height = 375
Left = 480
TabIndex = 10
Top = 1320
Width = 1335
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "制作:桂林理工大学-CH"
Height = 180
Left = 2400
TabIndex = 13
Top = 4680
Width = 1890
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim needUnload As Boolean
Private Sub Check2_Click()
If Check2.Value = 1 Then
Check1.Value = 1
End If
End Sub
Private Sub Command1_Click()
Randomize
If main.login(Text1.text, Text2.text, Val(ReadReg("", "type"))) Then '登录成功的话
If Check1.Value = 1 Then
WriteReg "", "zh", Text1.text
WriteReg "", "mm", Text2.text
End If
If Check2.Value = 1 Then
WriteReg "", "auto", "1"
Else
WriteReg "", "auto", "0"
End If
tray.show
tray.Visible = False
needUnload = True
Unload Me
Else
If ReadReg("", "auto") = "1" Then
Label5.Caption = "自动登录:" & errProxy(main.Error) & "|" & Int(Rnd * 10000)
Timer1.Interval = 2000
Timer1.Enabled = True
End If
If main.Error = "error5 waitsec <3" Then
Label5.Caption = "请3秒之后再试!" & Int(Rnd * 100)
ElseIf main.Error = "bind userid error" Then
MsgBox "您还未绑定此运营商的账号密码!请先选中校园网登录,进入后设置运营商账号密码即可!", vbInformation, "校园网登录时出错!"
ElseIf main.Error = "userid error1" Then
MsgBox "此校园网账号不存在!", vbInformation, "校园网登录时出错!"
ElseIf main.Error = "userid error2" Then
MsgBox "密码错误,请重新输入密码!", vbInformation, "校园网登录时出错!"
ElseIf main.Error = "Oppp error: can't find user." Then
MsgBox "您选择的运营商还未绑定账号,需先选择校园网登录后再绑定运营商账号!", vbInformation, "校园网登录时出错!"
Else
If Val(ReadReg("", "type")) = 0 Then
MsgBox main.Error, vbInformation, errProxy(main.Error) 'errProxy(main.Error) & Int(Rnd * 100)
Else
MsgBox main.Error, vbInformation, errProxy(main.Error)
End If
End If
End If
End Sub
Private Sub Command2_Click()
main.about
End Sub
Private Sub Form_Load()
Dim i As Long
WriteReg "", "test", "1"
If ReadReg("", "test") <> "1" Then
MsgBox "无法设置注册表!请右键使用管理员运行!", vbCritical, "检测"
End If
If App.PrevInstance Then
'tray.m_NotifyIcon.ShowBubble "多开提醒", "为保障程序运行稳定,请勿运行第二个实例,谢谢!"
MsgBox "您双开了!如果您觉得没有双开,可以使用任务管理器结束另一个进程!", vbInformation
End
End If
version = App.Major & "." & App.Minor & "." & App.Revision
Me.Caption = "桂林理工大学-校园网上网 " & version & " ——CH"
If Len(Command) >= 4 Then
Dim path As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Command = "update" Or Left(Command, 4) = "upin" Then
On Error Resume Next
DelayM 100
Randomize
If Left(Command, 4) = "upin" Then
path = App.path & "\" & Mid(Command, 5) & ".exe"
If Dir(path, vbNormal) <> "" Then '删除旧版本
Do
i = i + 1
fso.DeleteFile path, True
If Dir(path, vbNormal) = "" Then Exit Do '删除成功退出循环
DelayM 100
Loop Until i > 100
End If
End If
Dim file1 As String, file2 As String
file1 = App.path & "\" & App.ExeName & ".exe" '随机文件名
file2 = App.path & "\桂工校园网登录.exe" '规范化文件名
If Dir(file1, vbNormal) = "" Then
MsgBox "更新出错!找不到" & file1 & "但新版本已经为你下载好,但程序找不到文件:" & App.path & "\" & App.ExeName & ".exe" & vbCrLf & "请确保没放在盘根目录!"
End
End If
fso.CopyFile App.path & "\" & App.ExeName & ".exe", file2
Set fso = Nothing
Shell file2 & " upok" & App.ExeName, vbNormalFocus
End
End If
If Left(Command, 4) = "upok" Then
On Error Resume Next
DelayM 100
path = App.path & "\" & Mid(Command, 5) & ".exe"
If Dir(path, vbNormal) <> "" Then
Do
i = i + 1
fso.DeleteFile path, True
If Dir(path, vbNormal) = "" Then Exit Do
DelayM 100
Loop Until i > 100
End If
If ReadReg("", "auto") <> "1" Then
MsgBox "软件已成功自动更新!此程序路径:" & path & "" & vbCrLf & "点击确认启动!"
End If
End If
If Command = "autorun" Then
WriteReg "", "auto", "1"
'自动启动肯定是要自动登录
End If
End If
Set objScrCtl = CreateObject("MSScriptControl.ScriptControl") '初始化js解释器
objScrCtl.Language = "JavaScript"
Text1.text = ReadReg("", "zh")
Text2.text = ReadReg("", "mm")
Check1.Value = IIf(Text2.text <> "", 1, 0)
Check2.Value = IIf(ReadReg("", "auto") = "1", 1, 0)
Dim xiaoqu As Long
If ReadReg("", "xiaoqu") = "" Then
xiaoqu = 0
Else
xiaoqu = Val(ReadReg("", "xiaoqu"))
End If
Dim types As Long
If ReadReg("", "type") = "" Then
types = 0
Else
types = Val(ReadReg("", "type"))
End If
Option1(types).Value = True
Option2(xiaoqu).Value = True
'MsgBox md5.md5("1", 32)
Timer1.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Not needUnload Then End
End Sub
Private Sub Option1_Click(Index As Integer)
If Option1(Index).Value Then
WriteReg "", "type", Index
End If
End Sub
Private Sub Option2_Click(Index As Integer)
If Option2(Index).Value Then
If Index = 1 Then
If Option1(2).Value = True Then Option1(0).Value = True
Option1(2).Enabled = False
Else
Option1(2).Enabled = True
End If
WriteReg "", "xiaoqu", Index
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
If Timer1.Interval <> 2000 Then
If ReadReg("", "auto") <> "1" Then '没有自动登录,需要检查更新
main.checkUpdate
Else
Do
If main.checkUpdate() = 0 Then Exit Do
DelayM 2000
Loop Until 0
End If
End If
'MsgBox types
If ReadReg("", "auto") = "1" Then
Label5.Caption = "自动登录中..." & Rnd
Command1_Click
Else
'If main.check_login Then
'MsgBox "校园网已登录,请设置您的校园网账号密码,下次打开可快速登录。"
'End If
End If
End Sub