📄 start.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form start
Caption = "Form2"
ClientHeight = 7200
ClientLeft = 2625
ClientTop = 2400
ClientWidth = 9825
LinkTopic = "Form2"
ScaleHeight = 7200
ScaleWidth = 9825
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer2
Interval = 1000
Left = 8280
Top = 4560
End
Begin VB.Timer Timer1
Interval = 1000
Left = 9240
Top = 4560
End
Begin VB.CommandButton Command2
Caption = "退出考生系统"
Height = 375
Left = 3480
TabIndex = 6
Top = 6360
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "进入考试系统"
Enabled = 0 'False
Height = 375
Left = 480
TabIndex = 5
Top = 6360
Width = 1695
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 375
Left = 1680
TabIndex = 4
Text = "Text2"
Top = 4080
Width = 3255
End
Begin MSWinsockLib.Winsock Winsock1
Left = 8880
Top = 5520
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 375
Left = 1680
TabIndex = 2
Text = "Text1"
Top = 4560
Width = 3255
End
Begin VB.Label Label3
Caption = "服务器名:"
Height = 255
Left = 240
TabIndex = 3
Top = 4200
Width = 1215
End
Begin VB.Label Label2
Caption = "服务器连接情况:"
Height = 255
Left = 240
TabIndex = 1
Top = 4680
Width = 1575
End
Begin VB.Label Label1
Height = 3855
Left = 120
TabIndex = 0
Top = 120
Width = 9255
End
End
Attribute VB_Name = "start"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
If Text1.Text = "连接成功!" Then
Load Form1
Load Form3
start.Visible = False
Form1.Visible = True
Else
Winsock1.Close
Command1.Enabled = False
Command1.Caption = "进入考试系统"
Winsock1.Connect
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub
Private Sub Command2_Click()
Winsock1.Close
End
End Sub
Private Sub Form_Load()
kesu = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End
End Sub
Private Sub Timer1_Timer()
Static p As Integer
p = p + 1
If p = 10 Then
Timer1.Enabled = False
Text1.Text = "服务器没开或网络错误"
Command1.Caption = "从试网络..."
Command1.Enabled = True
p = 0
Timer2.Enabled = True
Else
Select Case Winsock1.State
Case 9
Text1.Text = "正在连接服务器..."
Case 7
Timer1.Enabled = False
Timer2.Enabled = False
Text1.Text = "连接成功!"
Command1.Enabled = True
End Select
End If
End Sub
Private Sub Timer2_Timer()
Static p2 As Integer
p2 = p2 + 1
If p2 = 8 Then
Winsock1.Close
Command1.Enabled = False
Command1.Caption = "进入考试系统"
Winsock1.Connect
Timer1.Enabled = True
Timer2.Enabled = False
p2 = 0
End If
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData dat
Select Case Left(dat, 8)
Case "user__ok"
For datamax = 9 To Len(dat)
If Mid(dat, datamax, 1) = "\" Then
Form1.Text3.Text = Mid(dat, 9, datamax - 9)
fen = Val(Mid(dat, datamax + 1)) - 1
Form1.Command1.Enabled = True
Exit For
End If
Next
Case "user_bad"
MsgBox Form1.Text1.Text & "该考号错误或非法!如若有错请联系教师!"
Form1.Text1.Text = ""
Form1.Text2.Text = ""
Form1.Text3.Text = ""
Form1.Text1.SetFocus
Case "sendname"
Form3.Text1.Text = Right(dat, Len(dat) - 8)
Open App.Path & "\student\" & Form1.Text1.Text & "\data\" & Form3.Text1.Text For Output As #25
kesu = kesu + 1
finename(kesu) = App.Path & "\student\" & Form1.Text1.Text & "\data\" & Form3.Text1.Text
start.Winsock1.SendData "loigdata"
Case "datasend"
savefine (dat)
Close #25
Case "data_end"
Load Form2
Form3.Animation1.AutoPlay = False
Form3.Visible = False
Unload Form3
Form2.Visible = True
start.Winsock1.SendData "startkao"
Case "kaolobad"
MsgBox Form1.Text1.Text & "该考号以登入过!如若有错请联系教师!"
Form1.Text1.Text = ""
Form1.Text2.Text = ""
Form1.Text3.Text = ""
Form1.Text1.SetFocus
Case "get_time"
Winsock1.SendData "put_time" & Trim(Str(fen))
Case "get_save"
Open App.Path & "\student\" & Form1.Text1.Text & "\data\stu.dat" For Binary As #32
Winsock1.SendData "put_save" & readfile(9, 32, 0)
Close #32
Case "save__ok"
If k = 66 Then
Form5.Visible = False
Else
Open App.Path & "\student\" & Form1.Text1.Text & "\data\ask004.c" For Binary As #32
Winsock1.SendData "put1save" & readfile(0, 32, 0)
Close #32
End If
Case "save_1ok"
Open App.Path & "\student\" & Form1.Text1.Text & "\data\ask005.c" For Binary As #32
Winsock1.SendData "put2save" & readfile(0, 32, 0)
Close #32
Form5.Visible = False
Case "ser_intf"
Load Form4
Form4.Visible = True
Form4.Caption = "信使-教师来信!"
Form4.Label1.Caption = Right(dat, Len(dat) - 8)
Form4.Command2.Visible = False
Case "save_ook"
Form5.Visible = False
Winsock1.SendData "end_stud"
Case "ok_unlog"
Load Form4
Form2.Visible = False
Form4.Visible = True
Form4.BorderStyle = 0
Form4.Label1.Caption = "你以成功交卷!10秒后退出系统"
Form4.Command1.Visible = False
Form4.Command2.Caption = "退出系统"
Form4.Timer1.Enabled = True
Form4.Command2.Width = Form4.Command2.Width + 120
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -