📄 demo_1_5.frm
字号:
Begin VB.Menu mnuData
Caption = "提取内容(&T)"
Begin VB.Menu mnuGrade
Caption = "学生成绩"
Checked = -1 'True
Index = 1
Shortcut = ^S
End
Begin VB.Menu mnuPresent
Caption = "考勤信息"
Checked = -1 'True
Index = 1
Shortcut = ^P
End
Begin VB.Menu mnuReward
Caption = "奖惩信息"
Checked = -1 'True
Index = 1
Shortcut = ^R
End
End
Begin VB.Menu mnuHelp
Caption = "帮助(&H)"
Begin VB.Menu mnuHelpFile
Caption = "帮助文件(&C)..."
Index = 2
End
Begin VB.Menu mnuAbout
Caption = "关于(&A)..."
Index = 2
End
End
End
Attribute VB_Name = "frmDemo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SmartRead_InitialAuth Lib "smartread.dll" (ByVal hwndFrom As Long, ByVal iSpeech As Long, _
ByVal iRate As Long, ByVal iVolume As Long, ByVal strMessage As String, ByVal strTip As String, ByVal strName As String, ByVal strMailBox As String) As Long
'初始化函数,使用语音功能前必须首先调用,可在初始化时设置初始语音,初始语速,初始音量,并可自定义显示信息
Private Declare Function SmartRead_Initial Lib "smartread.dll" (ByVal hwndFrom As Long, ByVal iSpeech As Long, _
ByVal iRate As Long, ByVal iVolume As Long, ByVal strMessage As String, ByVal strTip As String) As Long
'关闭函数,推出程序前必须调用
Private Declare Function SmartRead_Close Lib "smartread.dll" () As Long
'打开语音设置对话框,用于改变中英文语音,音量,语速,可自定义下载连接
Private Declare Function SmartRead_SetDialog Lib "smartread.dll" (ByVal hwndFrom As Long, ByVal strMessage As String) As Long
'朗读函数,第一个参数表示要朗读的文本,第二个参数表示朗读方式,第三个参数表示使用地语音,第四个参数表示使用的语速,第五个表示使用的音量
Private Declare Function SmartRead_Speak Lib "smartread.dll" (ByVal str As String, ByVal iStyle As Long, _
ByVal iSpeech As Long, ByVal iRate As Long, ByVal iVolume As Long, ByVal iPunctuation As Long, ByVal chLink As String) As Long
'停止朗读函数
Private Declare Function SmartRead_Stop Lib "smartread.dll" () As Long
'语音开发包版本信息,开在任何时候调用
Private Declare Function SmartRead_Version Lib "smartread.dll" () As BE_VERSION
'将文本朗读到WAVE文件的函数,可设置输出的文件,朗读语音,朗读语速,朗读音量
Private Declare Function SmartRead_SpeakToWave Lib "smartread.dll" (ByVal strText As String, ByVal strFile As String, ByVal iStyle As Long, _
ByVal iSpeech As Long, ByVal iRate As Long, ByVal iVolume As Long, ByVal iFormat As Long, ByVal iPunctuation As Long, ByVal chLink As String) As Long
Private flgConnected As Boolean
Enum CALL_STATE
CALL_STATE_IDLE
CALL_STATE_DIALING
CALL_STATE_CONNECTED
End Enum
Private CallState As CALL_STATE
Private stu As Integer
Dim StudentNo As String
Dim Telstr As String '新增加输入演示电话号码的功能
Private Sub ChkAuto_Click()
If ChkAuto.Value Then '自动提取
AutoTaken = True ’在什么地方定义的AutoTaken变量
stu = 0
TxtStudentNO.Locked = True
txtTelNum.Locked = True
TxtStudentName.Locked = True
TxtFamilyName.Locked = True
UpDown1.Enabled = True
TxtCount.Locked = False
Else '手工提取
AutoTaken = False
CmdTakeData.Enabled = True
UpDown1.Value = 1
UpDown1.Enabled = False
TxtCount.Locked = True
TxtStudentNO.Locked = False
txtTelNum.Locked = False
TxtStudentName.Locked = False
TxtFamilyName.Locked = False
CmdTakeData.Caption = "提取数据"
StudentNo = TxtStudentNO.Text
End If
End Sub
Private Sub cmbLines_Click()
v.Close
v.SetCurLine (cmbLines.ListIndex)
v.Open
Me.Caption = v.LineName
cmdDial.Enabled = True
v.LineForShowWave = cmbLines.ListIndex
v.Drop
End Sub
Private Sub CmdDemo_Click()
Dim ddd As Long
Dim VoiceStop As Long
Dim wavetext As String
If CmdDemo.Caption = "模拟放音" Then
CmdDemo.Caption = "停止放音"
CurrentPath = App.Path
wavetext = "尊敬的家长您好,东北大学东软信息技术学院向您通报您的孩子" + TxtStudentName.Text + "的在校情况" + TxtStudentInfo.Text + "感谢您的配合,再见!"
ddd = SmartRead_Speak(wavetext, 11, 0, 70, 100, 1, "http://www.cnetseek.com/gb/index.html")
ElseIf CmdDemo.Caption = "停止放音" Then
CmdDemo.Caption = "模拟放音"
VoiceStop = SmartRead_Stop()
End If
End Sub
Private Sub cmdDial_Click()
v.SetWaitTimeForConnection 60 'CLng(txtConnectTimeout.Text)
v.Dial txtTelNum.Text
CallState = CALL_STATE_DIALING
cmdDrop.Enabled = True
End Sub
Private Sub cmdDrop_Click()
v.Drop
CallState = CALL_STATE_IDLE
cmdDrop.Enabled = False
If OptLine Then
cmdStartOrStopPlay.Enabled = False
End If
flgConnected = False
If Not CmdTakeData.Caption = "提取完毕" Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
End Sub
Private Sub cmdExit_Click()
SmartRead_Stop
SmartRead_Close
Form_Unload (CmdExit)
End Sub
Private Sub cmdReset_Click()
TxtStudentName.Text = ""
TxtFamilyName.Text = ""
TxtStudentNO.Text = ""
txtTelNum.Text = ""
TxtStudentInfo.Text = ""
txtInfo.Text = ""
ChkAuto.Value = 1
UpDown1.Value = 1
CmbTerm.Text = "第一学期"
CmdTakeData.Enabled = True
CmdTakeData.Caption = "提取数据"
cmdDial.Enabled = False
CmdDemo.Caption = "模拟放音"
SmartRead_Stop
v.Drop
CmdDemo.Enabled = False
mnuUrgent(0).Checked = False
mnuGeneral(0).Checked = True
ChkAuto.Enabled = True
CmbTerm.Enabled = True
UrgentInfo = ""
stu = 0
End Sub
Private Sub cmdStartOrStopPlay_Click()
Dim ddd As Long
Dim wavetext As String
CurrentPath = App.Path
If mnuGeneral(0).Checked = True Then
wavetext = "尊敬的家长您好,东北大学东软信息技术学院向您通报您的孩子" + TxtStudentName.Text + "的在校情况" + TxtStudentInfo.Text + "感谢您的配合,再见!"
'朗读文本到WAVE文件中
ddd = SmartRead_SpeakToWave(wavetext, CurrentPath + "\temp\output.wav", 10, 0, 70, 100, 2, 1, "http://www.cnetseek.com/gb/index.html")
Else
wavetext = "尊敬的家长您好,东北大学东软信息技术学院向您通报" + TxtStudentInfo.Text + "感谢您的配合,再见!"
'朗读文本到WAVE文件中
ddd = SmartRead_SpeakToWave(wavetext, CurrentPath + "\temp\output.wav", 10, 0, 70, 100, 2, 1, "http://www.cnetseek.com/gb/index.html")
End If
If cmdStartOrStopPlay.Caption = "播放" Then '现在将要开始播放语音
optPlayFileRecorded = True
v.OpenWaveFile CurrentPath + "\temp\output.wav"
If v.ErrorNumber Then
showMsg v.ErrorDescribe
Exit Sub
End If
Dim nEquip As Integer
OptLine = True
nEquip = 0
v.StartPlaying nEquip, False
If v.ErrorNumber Then
showMsg v.ErrorDescribe
Exit Sub
End If
cmdStartOrStopPlay.Caption = "停止"
ElseIf cmdStartOrStopPlay.Caption = "停止" Then
v.Stop
cmdStartOrStopPlay.Caption = "播放"
End If
End Sub
Private Sub CmdTakeData_Click()
Dim OraSession As Object
Dim OraDatabase As Object
Dim OraXM As Object '学生姓名
Dim OraFamilyName As Object '家长姓名
Dim OraStuInfo As Object '学生奖惩信息
Dim StuCount As Integer '查询的学生个数
Dim Term As String '查询的时间——学期
Dim Lesson() As String '考试科目
Dim Grade() As String '考试成绩
Dim OraLB_Late As Object '学生迟到信息
Dim OraFields_LB_Late As Object
Dim OraLB_Absent As Object '学生旷课信息
Dim OraFields_LB_Absent As Object
Dim OraFields1_XM As Object '学生姓名
Dim OraFields1_FXM As Object '家长姓名
Dim OraLB_Ill As Object '学生病假信息
Dim OraFields_LB_Ill As Object
Dim OraLB_Affair As Object '学生事假信息
Dim OraFields_LB_Affair As Object
Dim OraFields_StuInfo As Object '学生奖惩信息
Dim OraStuTZSH As Object '学生通知书号
Dim OraFields_TZSH As Object
Dim OraExam_Lesson As Object '学生考试科目
Dim OraFields_Exam_Lesson As Object
Dim OraExam_Grade As Object '学生考试成绩
Dim OraFields_Exam_Grade As Object
Dim Ls_username As String, Ls_password As String, Ls_server As String
Dim Ls_mess As String
Dim Ls_Late As String
Dim Ls_Absent As String
Dim Ls_Ill As String
Dim Ls_Affair As String
Dim Ls_Exam As String
Dim StuName As String
Dim FamilyName As String
Dim Li_I As Integer
Dim StuNo(13) As String
Dim StudentNo As String
Dim StuInfo As String
Dim StuTZSH As String
StuNo(0) = "0101121017"
StuNo(1) = "0101120210"
StuNo(2) = "0101120424"
StuNo(3) = "0101120428"
StuNo(4) = "0101120429"
StuNo(5) = "0101120505"
StuNo(6) = "0101120507"
StuNo(7) = "0101120521"
StuNo(8) = "0101120526"
StuNo(9) = "0101120727"
StuNo(10) = "0101120730"
StuNo(11) = "0101120804"
StuNo(12) = "0101121010"
stu = 0
StuCount = CInt(TxtCount.Text)
If AutoTaken = True Then
If stu <= 12 Then
If stu < StuCount Then
CmdTakeData.Caption = "下一个"
TxtStudentNO.Text = StuNo(stu)
TxtStudentNO.Locked = True
txtTelNum.Locked = False
TxtStudentName.Locked = True
TxtFamilyName.Locked = False
StudentNo = TxtStudentNO.Text
End If
If stu = StuCount - 1 Then
CmdTakeData.Caption = "提取完毕"
CmdTakeData.Enabled = False
End If
stu = stu + 1
txtTelNum.Text = Telstr
CmdDemo.Enabled = True
Else
CmdTakeData.Caption = "提取完毕" '只用于演示,限13人
CmdTakeData.Enabled = False
MsgBox "演示自动查询到此为止!", vbOKOnly + vbInformation, "提示信息"
End If
Else
txtTelNum.Text = Telstr
StudentNo = TxtStudentNO.Text
CmdDemo.Enabled = True
TxtStudentNO.Locked = False
txtTelNum.Locked = False
TxtStudentName.Locked = False
TxtFamilyName.Locked = False
End If
If CmbTerm.Text = "第一学期" Then
Term = "1"
ElseIf CmbTerm.Text = "第二学期" Then
Term = "2"
ElseIf CmbTerm.Text = "第三学期" Then
Term = "3"
End If
Ls_server = "ufs" '连接张冬青Oracle数据库
Ls_username = "ufs" '用户名为 ufs
Ls_password = "password" '密码为 password
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
On Error GoTo Connect_err:
Set OraDatabase = OraSession.DbOpenDatabase(Ls_server, Ls_username + "/" + Ls_password, 0&) '执行SQL命令出错后跳转到Sql_err
On Error GoTo Sql_err:
Set OraXM = OraDatabase.DbCreateDynaset("SELECT XM FROM U_KQXX WHERE XH='" + StudentNo + "'", 0&) '对学生姓名进行检索
If OraXM.RecordCount = 0 Then '如果学号不存在
TxtStudentName.Text = ""
TxtFamilyName.Text = ""
TxtStudentNO.Text = ""
txtTelNum.Text = ""
TxtStudentInfo.Text = ""
txtInfo.Text = ""
cmdDial.Enabled = False
CmdDemo.Enabled = False
If stu = StuCount Then
stu = stu - 1
CmdTakeData.Caption = "下一个"
CmdTakeData.Enabled = True
End If
MsgBox "未查询到相应信息!", vbOKOnly + vbInformation, "提示信息"
End If
Set OraFields1_XM = OraXM.Fields '取得学生姓名
StuName = OraFields1_XM("XM").Value
TxtStudentName.Text = StuName
Set OraFamilyName = OraDatabase.DbCreateDynaset("SELECT XM AS FXM FROM U_JZXX WHERE XH='" + StudentNo + "'", 0&) '对学生家长姓名进行检索
Set OraFields1_FXM = OraFamilyName.Fields '取得家长姓名
FamilyName = OraFields1_FXM("FXM").Value
TxtFamilyName.Text = FamilyName
If mnuReward(1).Checked = True Then
Set OraStuInfo = OraDatabase.DbCreateDynaset("SELECT NR AS INF FROM U_JCXX WHERE DX='" + StudentNo + "'", 0&) '对学生奖惩信息进行检索
Set OraFields_StuInfo = OraStuInfo.Fields ' 取得学生奖惩信息
StuInfo = OraFields_StuInfo("INF").Value + ";"
End If
If mnuGrade(1).Checked = True Then
Set OraStuTZSH = OraDatabase.DbCreateDynaset("SELECT TZSH FROM JW_XSJBSJ WHERE STUDENT_NO='" + StudentNo + "'", 0&) '对学生通知书号信息进行检索
Set OraFields_TZSH = OraStuTZSH.Fields '取得通知书号
StuTZSH = OraFields_TZSH("TZSH").Value
Set OraExam_Lesson = OraDatabase.DbCreateDynaset("SELECT KCMC AS ONE FROM JW_XSCJ WHERE TZSH='" + StuTZSH + "'" + "AND XQ='" + Term + "'", 0&) '查询学生在查询时间内的考试门数
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -