设为首页 收藏本站
查看: 1429|回复: 0

[经验分享] IBM viavoice语音识别引擎vv的通用类以及调用方法

[复制链接]

尚未签到

发表于 2017-5-27 10:28:06 | 显示全部楼层 |阅读模式
  #include "stdafx.h"
#include "vvengine.h"
  
/////////////////////////////////////////////////////////////////////////////
// CVVEngine properties
  /////////////////////////////////////////////////////////////////////////////
// CVVEngine operations
  void CVVEngine::AboutBox()
{
InvokeHelper(0xfffffdd8, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
  void CVVEngine::Connect()
{
InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
  BOOL CVVEngine::CanConnect()
{
BOOL result;
InvokeHelper(0x2, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
  void CVVEngine::Disconnect()
{
InvokeHelper(0x3, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
  void CVVEngine::ClearAllProperties()
{
InvokeHelper(0x4, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
  void CVVEngine::ResetAllProperties()
{
InvokeHelper(0x5, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
  long CVVEngine::GetAudioState()
{
long result;
InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
  void CVVEngine::SetAudioState(long nNewValue)
{
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
nNewValue);
}
  BOOL CVVEngine::GetEventsEnabled(long Events)
{
BOOL result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, parms,
Events);
return result;
}
  void CVVEngine::SetEventsEnabled(long Events, BOOL bNewValue)
{
static BYTE parms[] =
VTS_I4 VTS_BOOL;
InvokeHelper(0x7, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
Events, bNewValue);
}
  BOOL CVVEngine::GetAutoUI()
{
BOOL result;
InvokeHelper(0x8, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  void CVVEngine::SetAutoUI(BOOL bNewValue)
{
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0x8, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
bNewValue);
}
  BOOL CVVEngine::GetAutoConnect()
{
BOOL result;
InvokeHelper(0x9, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  void CVVEngine::SetAutoConnect(BOOL bNewValue)
{
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0x9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
bNewValue);
}
  BOOL CVVEngine::GetIsConnected()
{
BOOL result;
InvokeHelper(0xa, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  BOOL CVVEngine::GetAutoStartAudio()
{
BOOL result;
InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  void CVVEngine::SetAutoStartAudio(BOOL bNewValue)
{
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0xb, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
bNewValue);
}
  LPUNKNOWN CVVEngine::GetISRCentral()
{
LPUNKNOWN result;
InvokeHelper(0xc, DISPATCH_METHOD, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
  LPUNKNOWN CVVEngine::GetISRListen()
{
LPUNKNOWN result;
InvokeHelper(0xd, DISPATCH_METHOD, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
  long CVVEngine::GetAudioSourceType()
{
long result;
InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
  void CVVEngine::SetAudioSourceType(long nNewValue)
{
static BYTE parms[] =
VTS_I4;
InvokeHelper(0xe, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
nNewValue);
}
  CString CVVEngine::GetEngineID()
{
CString result;
InvokeHelper(0xf, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
  CString CVVEngine::GetMfgName()
{
CString result;
InvokeHelper(0x10, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
  CString CVVEngine::GetProdName()
{
CString result;
InvokeHelper(0x11, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
  CString CVVEngine::GetModeID()
{
CString result;
InvokeHelper(0x12, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
  CString CVVEngine::GetModeName()
{
CString result;
InvokeHelper(0x13, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
  CString CVVEngine::GetDialect()
{
CString result;
InvokeHelper(0x14, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
  long CVVEngine::GetLanguageID()
{
long result;
InvokeHelper(0x15, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
  long CVVEngine::GetMaxWordsVocab()
{
long result;
InvokeHelper(0x16, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
  long CVVEngine::GetMaxWordsState()
{
long result;
InvokeHelper(0x17, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
  BOOL CVVEngine::GetNeedsCFG()
{
BOOL result;
InvokeHelper(0x18, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  BOOL CVVEngine::GetNeedsDictation()
{
BOOL result;
InvokeHelper(0x19, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  BOOL CVVEngine::GetNeedsLD()
{
BOOL result;
InvokeHelper(0x1a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  BOOL CVVEngine::GetUseSharedEngine()
{
BOOL result;
InvokeHelper(0x1b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
  long CVVEngine::GetSpeakingStyle()
{
long result;
InvokeHelper(0x1f, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
  void CVVEngine::SetSpeakingStyle(long nNewValue)
{
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x1f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
nNewValue);
}
  CString CVVEngine::GetSubject()
{
CString result;
InvokeHelper(0x20, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
#include "stdafx.h"
#include "vvmdoc.h"
  #include "vvmdocDoc.h"
#include "vvmdocView.h"
  #ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
  /////////////////////////////////////////////////////////////////////////////
// CVvmdocView
  IMPLEMENT_DYNCREATE(CVvmdocView, CView)
  BEGIN_MESSAGE_MAP(CVvmdocView, CView)
//{{AFX_MSG_MAP(CVvmdocView)
ON_COMMAND(IDM_BEGINDICTATION, OnBegindictation)
ON_COMMAND(IDM_STOPDICTATION, OnStopdictation)
ON_WM_SETFOCUS()
ON_WM_SIZE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
  /////////////////////////////////////////////////////////////////////////////
// CVvmdocView construction/destruction
  CVvmdocView::CVvmdocView()
{
// TODO: add construction code here
  }
  CVvmdocView::~CVvmdocView()
{
}
  BOOL CVvmdocView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
  return CView::PreCreateWindow(cs);
}
  /////////////////////////////////////////////////////////////////////////////
// CVvmdocView drawing
  void CVvmdocView::OnDraw(CDC* pDC)
{
CVvmdocDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
  // TODO: add draw code for native data here
}
  /////////////////////////////////////////////////////////////////////////////
// CVvmdocView printing
  BOOL CVvmdocView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
  void CVvmdocView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
  void CVvmdocView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
  /////////////////////////////////////////////////////////////////////////////
// CVvmdocView diagnostics
  #ifdef _DEBUG
void CVvmdocView::AssertValid() const
{
CView::AssertValid();
}
  void CVvmdocView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
  CVvmdocDoc* CVvmdocView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVvmdocDoc)));
return (CVvmdocDoc*)m_pDocument;
}
#endif //_DEBUG
  /////////////////////////////////////////////////////////////////////////////
// CVvmdocView message handlers
  void CVvmdocView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);

if ( ::IsWindow(m_vvtextbox) )
m_vvtextbox.MoveWindow(0, 0, cx, cy);
}
  void CVvmdocView::OnInitialUpdate()
{
BOOL rc = FALSE;
WINDOWPLACEMENT wp;
  CView::OnInitialUpdate();

GetWindowPlacement( &wp );
wp.rcNormalPosition.right -= 4;
wp.rcNormalPosition.bottom -= 4;
  rc = m_vvtextbox.CreateControl("ViaVoice.VVTextBox",
NULL,
WS_VISIBLE,
wp.rcNormalPosition,
this,
IDC_VVTEXTBOX1);
if ( rc == FALSE )
AfxMessageBox("Create TextBox failed");
else
{
m_vvtextbox.Init();
m_vvtextbox.SetAutoUI( TRUE );
m_vvtextbox.SetAutoDictation( FALSE );
m_vvtextbox.SetMultiline( TRUE );
}
}
  BEGIN_EVENTSINK_MAP(CVvmdocView, CView)
//{{AFX_EVENTSINK_MAP(CVvmdocView)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, 1 /* Change */, OnChangeVvtextbox1, VTS_NONE)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -600 /* Click */, OnClickVvtextbox1, VTS_PI2 VTS_PBOOL)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -601 /* DblClick */, OnDblClickVvtextbox1, VTS_PI2 VTS_PBOOL)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -602 /* KeyDown */, OnKeyDownVvtextbox1, VTS_PI2 VTS_PI2)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -603 /* KeyPress */, OnKeyPressVvtextbox1, VTS_PI2)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -604 /* KeyUp */, OnKeyUpVvtextbox1, VTS_PI2 VTS_PI2)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -605 /* MouseDown */, OnMouseDownVvtextbox1, VTS_PI2 VTS_PI2 VTS_PR4 VTS_PR4)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -607 /* MouseUp */, OnMouseUpVvtextbox1, VTS_PI2 VTS_PI2 VTS_PR4 VTS_PR4)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -606 /* MouseMove */, OnMouseMoveVvtextbox1, VTS_PI2 VTS_PI2 VTS_PR4 VTS_PR4)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, 10 /* DictationStateChange */, OnDictationStateChangeVvtextbox1, VTS_BOOL)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, 11 /* MicStateChange */, OnMicStateChangeVvtextbox1, VTS_BOOL)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, 15 /* VuMeter */, OnVuMeterVvtextbox1, VTS_PI2)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, 16 /* MaxText */, OnMaxTextVvtextbox1, VTS_NONE)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, 17 /* Command */, OnCommandVvtextbox1, VTS_I4 VTS_BSTR)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, 18 /* TextRecod */, OnTextRecodVvtextbox1, VTS_BSTR)
ON_EVENT(CVvmdocView, IDC_VVTEXTBOX1, -608 /* Error */, OnErrorVvtextbox1, VTS_I2 VTS_PBSTR VTS_PI4 VTS_PBSTR VTS_PBSTR VTS_PI4 VTS_PBOOL)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
  
void CVvmdocView::OnChangeVvtextbox1()
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnClickVvtextbox1(short FAR* Button, BOOL FAR* bCancel)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnDblClickVvtextbox1(short FAR* Button, BOOL FAR* bCancel)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnKeyDownVvtextbox1(short FAR* KeyCode, short FAR* Shift)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnKeyPressVvtextbox1(short FAR* KeyAscii)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnKeyUpVvtextbox1(short FAR* KeyCode, short FAR* Shift)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnMouseDownVvtextbox1(short FAR* Button, short FAR* Shift, float FAR* X, float FAR* Y)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnMouseUpVvtextbox1(short FAR* Button, short FAR* Shift, float FAR* X, float FAR* Y)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnMouseMoveVvtextbox1(short FAR* Button, short FAR* Shift, float FAR* X, float FAR* Y)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnDictationStateChangeVvtextbox1(BOOL DictationOn)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnMicStateChangeVvtextbox1(BOOL bMicOn)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnVuMeterVvtextbox1(short FAR* sLevel)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnMaxTextVvtextbox1()
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnCommandVvtextbox1(long CmdID, LPCTSTR strCommand)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnTextRecodVvtextbox1(LPCTSTR strText)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnErrorVvtextbox1(short sErrorID, BSTR FAR* pstrDescription, long FAR* hresult, BSTR FAR* strSource, BSTR FAR* strHelp, long FAR* lHelpID, BOOL FAR* bShow)
{
// TODO: Add your control notification handler code here

}
  void CVvmdocView::OnBegindictation()
{
m_vvtextbox.SetDictationOn( TRUE );
}
  void CVvmdocView::OnStopdictation()
{
m_vvtextbox.SetDictationOn( FALSE );
}
  void CVvmdocView::OnSetFocus(CWnd* pOldWnd)
{
CView::OnSetFocus(pOldWnd);

m_vvtextbox.SetFocus();
}

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-381666-1-1.html 上篇帖子: 软件开发组的团队精神 (一个程序员在IBM的开发经验) 下篇帖子: 使用 IBM 静态工具优化 Java 代码,第 2 部分: 分析错误报告
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表