📄 password.frm
字号:
VERSION 5.00
Begin VB.Form Form1
AutoRedraw = -1 'True
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "四方考试系统--登录窗口"
ClientHeight = 3300
ClientLeft = 45
ClientTop = 330
ClientWidth = 6435
DrawStyle = 5 'Transparent
Icon = "password.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3300
ScaleWidth = 6435
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
BackColor = &H00E0E0E0&
Caption = "退出系统"
Height = 375
Left = 4920
Style = 1 'Graphical
TabIndex = 5
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command1
BackColor = &H00E0E0E0&
Caption = "考号验证"
Height = 375
Left = 4920
Style = 1 'Graphical
TabIndex = 4
Top = 1320
Width = 1095
End
Begin VB.Frame Frame1
BackColor = &H00E0E0E0&
Caption = "输入考生信息:"
Height = 2295
Left = 240
TabIndex = 0
Top = 720
Width = 4215
Begin VB.TextBox Text2
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
Enabled = 0 'False
Height = 375
Left = 1440
Locked = -1 'True
TabIndex = 10
Top = 998
Width = 2415
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 375
Left = 1440
Locked = -1 'True
TabIndex = 9
Top = 1598
Width = 2415
End
Begin VB.TextBox Text1
BeginProperty DataFormat
Type = 1
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
Height = 375
Left = 1440
TabIndex = 7
Top = 398
Width = 2415
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H00E0E0E0&
Caption = "考生姓名:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 360
TabIndex = 3
Top = 1680
Width = 945
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00E0E0E0&
Caption = "准考证号:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 360
TabIndex = 2
Top = 480
Width = 945
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00E0E0E0&
Caption = "班级名称:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 360
TabIndex = 1
Top = 1080
Width = 945
End
End
Begin VB.Frame Frame2
BackColor = &H00E0E0E0&
Height = 2295
Left = 4680
TabIndex = 8
Top = 720
Width = 1575
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00E0E0E0&
Caption = "考试系统"
BeginProperty Font
Name = "楷体_GB2312"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00404040&
Height = 435
Left = 2040
TabIndex = 6
Top = 120
Width = 1875
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Cn As New ADODB.Connection
Dim Rst As New ADODB.Recordset
Dim i As Integer
Private Sub Command1_Click()
On Error Resume Next
If ksyz = 1 Then
Unload Me
Form2.Show '考生是恢复考试,直接进行系统
Exit Sub
End If
'考生是第一次考试,进行系统初始化
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile(App.Path & "\testfile.txt", True) '打开文本文件并进行写操作'
ts.writeline (Text1.Text) '考生准考证号
ts.writeline (Text2.Text) '考生班级
ts.writeline (Text3.Text) '考生姓名
ts.writeline (5999) '考试时间,100分钟
ts.writeline (0) '考试分数为0
ts.writeline (0) '理论考试试卷没有生成,为0
ts.Close
zkzh = Text1.Text
bj = Text2.Text
xm = Text3.Text
time1 = 5999
sum = 0
ksdo = 0
Unload Me
Form2.Show
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
If App.PrevInstance Then
MsgBox "四方考试系统已经正在运行!"
AppActivate App.Title
Unload Form1
End If '另一个实例正在运行时,在关闭这个新实例前,激活已有的实例
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.fileexists(App.Path & "\kssj.mdb") Then
response = MsgBox("本机没有考试试卷,请老师重新发放试卷,退出", vbOKOnly + vbInformation, "提示")
If response = 1 Then
Unload Form1
End If
End If '测试本机有没有考试试卷
If fso.fileexists(App.Path & "\testfile.txt") Then '文件testfile.txt是否存在
response = MsgBox("是否恢复上一次中断的考试信息", vbYesNo + vbInformation + vbDefaultButton1, "提示")
If response = vbYes Then '恢复上一次考试信息,则进行读操作
Set ts = fso.opentextfile(App.Path & "\testfile.txt")
Text1.Text = ts.readline
Text2.Text = ts.readline
Text3.Text = ts.readline
zkzh = Text1.Text '准考证号
bj = Text2.Text '班级号
xm = Text3.Text '考生姓名
time1 = ts.readline '继上一次考试剩余时间信息
sum = ts.readline '上一次考试得分
ksdo = ts.readline '标志选择题已生成随机试卷了
ksyz = 1 '恢复考试,不进行输入准考证号检验,按钮不操作.
Else
fso.deletefile (App.Path & "\testfile.txt")
Text1.Text = "123456"
Text2.Text = "04计算机(1)"
Text3.Text = "张明军" '如果有,不继续上一次考试信息,则删除文件
sum = 0 '各个相关数据变量赋初值, 成绩为0,时间为1个小时,KSDO标志选择题没有生成试卷。
time1 = 5999
ksdo = 0
ysyz = 0 '从新开始考试,初值为0
End If
Else
Text1.Text = "123456"
Text2.Text = "04计算机(1)"
Text3.Text = "张明军" '如果有,不继续上一次考试信息,则删除文件
sum = 0 '各个相关数据变量赋初值, 成绩为0,时间为1个小时,KSDO标志选择题没有生成试卷。
time1 = 5999
ksdo = 0
ysyz = 0 '从新开始考试,初值为0
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set fso = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -