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


VERSION 5.00 
Object = "{D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0"; "Flash.ocx" 
Begin VB.Form Form1  
   BackColor       =   &H00FFFFFF& 
   Caption         =   "Form1" 
   ClientHeight    =   9135 
   ClientLeft      =   60 
   ClientTop       =   450 
   ClientWidth     =   13530 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   9135 
   ScaleWidth      =   13530 
   StartUpPosition =   3  '窗口缺省 
   Begin VB.TextBox Text2  
      Height          =   375 
      Left            =   1800 
      TabIndex        =   3 
      Text            =   "Text2" 
      Top             =   240 
      Width           =   1095 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "测试" 
      Height          =   375 
      Left            =   10080 
      TabIndex        =   2 
      Top             =   8280 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Left            =   240 
      TabIndex        =   1 
      Top             =   8640 
      Width           =   6855 
   End 
   Begin ShockwaveFlashObjectsCtl.ShockwaveFlash ShockwaveFlash1  
      Height          =   8655 
      Left            =   -120 
      TabIndex        =   0 
      Top             =   720 
      Width           =   14655 
      _cx             =   25850 
      _cy             =   15266 
      FlashVars       =   "" 
      Movie           =   "E:\mydcuments\flash\test.swf" 
      Src             =   "E:\mydcuments\flash\test.swf" 
      WMode           =   "Window" 
      Play            =   0   'False 
      Loop            =   0   'False 
      Quality         =   "High" 
      SAlign          =   "" 
      Menu            =   -1  'True 
      Base            =   "" 
      AllowScriptAccess=   "always" 
      Scale           =   "ShowAll" 
      DeviceFont      =   0   'False 
      EmbedMovie      =   -1  'True 
      BGColor         =   "" 
      SWRemote        =   "" 
      MovieData       =   "" 
   End 
End 
Attribute VB_Name = "Form1" 
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 
 
Private Sub Form_Load() 
m_cChars = 0 
  Select Case flag 
 Case "1" 
 Text2.Text = flag 
  ShockwaveFlash1.GotoFrame (1) 
  ShockwaveFlash1.Play 
   Case "2" 
   flag = "0" 
   Case "3" 
     ShockwaveFlash1.GotoFrame (83) 
  ShockwaveFlash1.Play 
   Case "4" 
   flag = "0" 
End Select 
 
End Sub 
 
Private 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 "jj" 
     strText = "夹紧" 
   'x = MsgBox("执行夹紧操作吗?", vbOKCancel, "动作确认") 
   Unload Me 
Form2.Show 
 
   Case "sk" 
        strText = "松开" 
       ' x = MsgBox("执行松开操作吗?", vbOKCancel, "动作确认") 
Form3.Show 
Unload Me 
 
 
 
 
 'Select Case py 
 'Case "qd" 
 'x = 1 
  'ShockwaveFlash1.GotoFrame (83) 
'ShockwaveFlash1.Play 
  ' Case "qx" 
'x = 2 
   ' End Select 
   
     Case "s" 
      strText = "上" 
  
   Case "x" 
      strText = "下" 
  End Select 
    Text1.SelStart = m_cChars 
   Text1.SelText = strText & " " 
    m_cChars = m_cChars + 1 + Len(strText) 
     
 Text2.Text = flag 
 
End Sub