| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 743 人关注过本帖
标题:vb语音报警问题请教
只看楼主 加入收藏
lvdeyan
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-12-18
收藏
 问题点数:0 回复次数:0 
vb语音报警问题请教
各位好:
       我是vb新手,有关vb里编写语音报警问题,请各位指点下。
       我用的软件是ifix,编程环境是vb,在xp系统下编写的程序可以实现语音报警和报警声音取消,但在windows server2003环境下,该程序能实现语音报警,但不能实现报警声音取消。
       请问代码部分需要做怎么样修改?API修改什么地方?
       非常感谢!
以下是代码:
    Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1         '  play asynchronously
Private Const SND_LOOP = &H8         '  loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4         '  lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2         '  silence not default, if sound not found
Private Const SND_NOSTOP = &H10        '  don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000      '  don't wait if the driver is busy
Private Const SND_PURGE = &H40               '  purge non-static events for task
Private Const SND_SYNC = &H0         '  play synchronously (default)
   
Dim SndFile As String


Private Sub AlarmSummaryOCX1_NewAlarm(strNode As String, strTag As String)
       On Error Resume Next
    Dim tNode0 As String, tTag0 As String
    tNode0 = Trim(strNode)
    tTag0 = Trim(strTag)
    Do While InStr(1, tNode0, "  ", vbTextCompare) > 0
        tNode0 = Replace(tNode0, "  ", " ", , , vbTextCompare)
    Loop
    Do While InStr(1, tTag0, "  ", vbTextCompare) > 0
        tTag0 = Replace(tTag0, "  ", " ", , , vbTextCompare)
    Loop
    Dim tAlmStatus As String
    Dim tNode() As String, tTag() As String
    tNode = Split(tNode0, " ", , vbTextCompare)
    tTag = Split(tTag0, " ", , vbTextCompare)
    Dim i As Long
   
    For i = 0 To UBound(tNode)
        If Trim(tNode(i)) <> "" And Trim(tTag(i)) <> "" Then
            tAlmStatus = Trim(ReadValue("FIX32." & Trim(tNode(i)) & "." & Trim(tTag(i)) & "." & "A_CUALM"))
            If tAlmStatus = "HI" Or tAlmStatus = "HIHI" Or tAlmStatus = "CFN" Then
                PlaySound SndFile, 0, SND_ASYNC + SND_LOOP + SND_NODEFAULT + SND_NOSTOP + SND_NOWAIT
                Exit For
            End If
        End If
    Next i
End Sub

Private Sub CFixPicture_Initialize()
    SndFile = System.ProjectPath
    SndFile = SndFile & "\ALM\alarm.wav"
    AlarmSummaryOCX1.CheckForNewAlarms = True
    AlarmSummaryOCX1.AlarmHornEnabled = False
End Sub
'确认报警,取消声音,下面这段代码在xp下可以取消声音,server2003环境下取消不了声音
Private Sub CommandButton1_Click()
    AlarmSummaryOCX1.AckAllAlarms
    PlaySound vbNull, vbNull, vbNull
End Sub
 
搜索更多相关主题的帖子: 编程 软件 windows xp系统 语音 
2011-12-18 15:50
快速回复:vb语音报警问题请教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031397 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved