⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.bas

📁 这是一个用VB编写的在线考试系统
💻 BAS
字号:
Attribute VB_Name = "Module1"
Option Explicit
'finename(12)用来保存当前考试的题类的文件所在
'kaoiq(8,50)用来保存考生的考试答案
'多选题中A用1,B用5,C用7,D用9来算
'单选题中A1B2C3D4
'判断题中对1错2
'kaonull用来说明是否为从考
Public kaonull As Integer
Public datamax As Long
Public datamix As Integer
Public kesu As Integer
Public fen As Integer
Public dat As String
Public miao As Integer
Public k As Integer
Public byhwnd As Long
Public prg As String
Public kaohao(8) As String
Public kaoiq(8, 50) As Integer
Public kaoask(8) As String
Public finename(8) As String
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Sub Main()
If Not FindWindow(vbNullString, "绝龙考试系统考生端") = 0 Then
MsgBox "绝龙考试系统考生端在本地只能执行一个实例"
End
End If
Load start
start.Timer2.Enabled = False
start.Timer1.Enabled = False
Open App.Path & "\readme.dat" For Input As #26
Do While (Not EOF(26))
Input #26, dat
start.Label1.Caption = start.Label1.Caption & dat & Chr(13)
Loop
Close #26
Open App.Path & "\config.dat" For Binary As #26
start.Text2.Text = readfile(0, 26, 0)
start.Winsock1.RemoteHost = readfile(0, 26, 0)
start.Winsock1.RemotePort = readfile(0, 26, 0)
prg = readfile(0, 26, 0)
Close #26
start.Caption = start.Text2.Text & "考生端"
start.Text1.Text = "正在初时化..."
start.Visible = True
start.Winsock1.Connect
start.Timer1.Enabled = True
fen = 0
kaonull = 0
End Sub
Public Function savefine(dat As String)
Print #25, Right(dat, Len(dat) - 8)
dat = ""
start.Winsock1.SendData "get_data"
End Function
Function readfile(seekid As Integer, fileid As Integer, hao As Integer) As String
'seekid是功能码用来说明本次是何操作
'fileid是文件号说明要对哪个文件进行操作
'hao:备用说明,
Dim st As String
Dim sa As String * 1
Dim sb As String * 1
Select Case seekid
Case 0
'get next
If Seek(fileid) >= LOF(fileid) Then
readfile = "file_end"
Exit Function
End If
Do While 1
Get #fileid, , sa
If sa = Chr(16) Then
Get #fileid, , sb
If sb = Chr(17) Then
readfile = st
Seek #fileid, Seek(fileid) + 2
Exit Function
Else
Seek #fileid, Seek(fileid) - 1
End If
End If
st = st & sa
If Seek(fileid) >= LOF(fileid) + 1 Then
readfile = st
Exit Function
End If
Loop
Case 1
' go top
Seek #fileid, 1
readfile = readfile(0, fileid, 0)
Exit Function
Case 2
' go -1
If Seek(fileid) = 1 Then
readfile = "seek_one"
Exit Function
End If
Dim ba As Byte
Dim bb As Byte
Dim bc As Byte
Dim bd As Byte
bc = &H10
bd = &H11
Seek #fileid, Seek(fileid) - 5
Do While 1
If Seek(fileid) = 1 Then
readfile = readfile(0, fileid, 0)
Exit Function
End If
Get #fileid, , ba
If ba = bc Then
Get #fileid, , bb
If bb = bd Then
Seek #fileid, Seek(fileid) + 2
If hao = -1 Then
If Seek(fileid) = 1 Then
k = 1
End If
readfile = readfile(0, fileid, 0)
Exit Function
Else
readfile = readfile(2, fileid, hao - 1)
Exit Function
End If
Else
Seek #fileid, Seek(fileid) - 1
End If
End If
Seek #fileid, Seek(fileid) - 2
Loop
Case 3
'go boot
Seek #fileid, LOF(fileid)
readfile = readfile(0, fileid, 0)
Exit Function
Case 5
Dim x As Integer
For x = 1 To hao * 2
readfile = readfile(0, fileid, 0)
Next
Exit Function
Case 9
Dim stra, strb As String
stra = ""
strb = ""
stra = readfile(0, fileid, 0)
Do While 1
strb = strb & stra & Chr(16) & Chr(17) & Chr(13) & Chr(10)
stra = readfile(0, fileid, 0)
If stra = "file_end" Then
readfile = Left(strb, Len(strb) - 2)
Exit Function
End If
Loop
End Select
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -