www.pudn.com > speech_test.rar > Form3.frm


VERSION 5.00 
Begin VB.Form Form3  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "动作确认" 
   ClientHeight    =   1755 
   ClientLeft      =   45 
   ClientTop       =   435 
   ClientWidth     =   2745 
   LinkTopic       =   "Form3" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   1755 
   ScaleWidth      =   2745 
   StartUpPosition =   3  '窗口缺省 
   Begin VB.CommandButton Command2  
      Caption         =   "取消" 
      Height          =   375 
      Left            =   1560 
      TabIndex        =   1 
      Top             =   1080 
      Width           =   855 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "确定" 
      Height          =   375 
      Left            =   240 
      TabIndex        =   0 
      Top             =   1080 
      Width           =   975 
   End 
   Begin VB.Label Label1  
      Caption         =   "执行松开操作吗?" 
      Height          =   255 
      Left            =   600 
      TabIndex        =   2 
      Top             =   360 
      Width           =   1575 
   End 
End 
Attribute VB_Name = "Form3" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim WithEvents RecoContext As SpSharedRecoContext 
Attribute RecoContext.VB_VarHelpID = -1 
Dim Grammar As ISpeechRecoGrammar 
 
Private Sub Command1_Click() 
Set RecoContext = New SpSharedRecoContext 
        Set Grammar = RecoContext.CreateGrammar(1) 
        Grammar.DictationLoad 
        Grammar.DictationSetState SGDSActive 
End Sub 
 
Public Sub RecoContext_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) 
    strText = Result.PhraseInfo.GetText 
    
   py = GetCode(strText) 
   Select Case py 
 
  Case "qd" 
   flag = "3" 
    
  Case "qx" 
  flag = "4" 
End Select 
Form1.Show 
Unload Me 
 
End Sub