📄 frmalert.frm
字号:
VERSION 5.00
Object = "{F5BE8BC2-7DE6-11D0-91FE-00C04FD701A5}#2.0#0"; "agentctl.dll"
Begin VB.Form frmAlert
Caption = "Form1"
ClientHeight = 555
ClientLeft = 2310
ClientTop = 1695
ClientWidth = 1620
LinkTopic = "Form1"
ScaleHeight = 555
ScaleWidth = 1620
Begin VB.Timer timDelay
Enabled = 0 'False
Interval = 3000
Left = 960
Top = 0
End
Begin AgentObjectsCtl.Agent agtAlert
Left = 0
Top = 0
End
End
Attribute VB_Name = "frmAlert"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public AgentName As String
Public SpeakText As String
Public Repeat As Boolean
Public ThisIsATest As Boolean
Dim strSpeak As String
Dim objChar As IAgentCtlCharacterEx
Dim objRequest As IAgentCtlRequest
Dim objShow As IAgentCtlRequest
Dim objHide As IAgentCtlRequest
Dim objSpeak As IAgentCtlRequest
Dim objPlay As IAgentCtlRequest
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Const SND_LOOP = &H8
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub agtAlert_RequestComplete(ByVal Request As Object)
Select Case Request
Case objShow
Case objPlay
Case objSpeak
Set objHide = objChar.Hide
Case objHide
If Repeat Then
timDelay.Interval = 5000
timDelay.Enabled = True
Else
agtAlert.Characters.Unload AgentName
Unload Me
End If
End Select
End Sub
Public Sub AgentShow()
Static BeenHere As Boolean
On Error Resume Next
If Not BeenHere Then
agtAlert.Characters.Load AgentName, AgentName & ".acs"
BeenHere = True
End If
On Error Resume Next
Set objChar = agtAlert.Characters(AgentName)
If Err Then
agtAlert.Characters.Load AgentName, AgentName & ".acs"
Set objChar = agtAlert.Characters(AgentName)
End If
Set objShow = objChar.Show
End Sub
Public Sub AgentHide()
Set objHide = objChar.Hide
End Sub
Public Sub AgentSpeak()
Dim s As String
If SpeakText > " " Then
s = SpeakText
Else
s = "Hello everybody!"
End If
Set objSpeak = objChar.Speak(s)
End Sub
Public Sub AgentPlay(act As String)
Set objPlay = objChar.Play(act)
End Sub
Public Sub Trigger()
Repeat = False
ThisIsATest = False
DoEvents
Me.Show 0
'MakeTopWnd Me.hWnd
timDelay.Interval = 250
timDelay.Enabled = True
End Sub
Private Sub Form_Load()
'Set objChar = Nothing
End Sub
Private Sub timDelay_Timer()
timDelay.Enabled = False
If Not Repeat Then Unload Me
If AgentName > " " Then
AgentShow
AgentPlay "Wave"
AgentSpeak
Else
timDelay.Interval = 3000
timDelay.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -