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


VERSION 5.00 
Begin VB.Form Form2  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "动作确认" 
   ClientHeight    =   1830 
   ClientLeft      =   45 
   ClientTop       =   435 
   ClientWidth     =   2760 
   LinkTopic       =   "Form2" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   1830 
   ScaleWidth      =   2760 
   StartUpPosition =   3  '窗口缺省 
   Begin VB.CommandButton Command2  
      Caption         =   "取消" 
      Height          =   375 
      Left            =   1560 
      TabIndex        =   2 
      Top             =   1080 
      Width           =   855 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "确定" 
      Height          =   375 
      Left            =   360 
      TabIndex        =   1 
      Top             =   1080 
      Width           =   855 
   End 
   Begin VB.Label Label2  
      Caption         =   "Label2" 
      Height          =   375 
      Left            =   2040 
      TabIndex        =   3 
      Top             =   480 
      Width           =   735 
   End 
   Begin VB.Label Label1  
      Caption         =   "执行夹紧操作吗?" 
      Height          =   375 
      Left            =   720 
      TabIndex        =   0 
      Top             =   240 
      Width           =   1575 
   End 
End 
Attribute VB_Name = "Form2" 
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 Form_Load() 
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 = "1" 
Label2.Caption = flag 
  Case "qx" 
  flag = "2" 
End Select 
 
  
Form1.Show 
 Unload Me 
 
End Sub