【VFB】ISpVoice语音(VFB源码)微软TTS语音引擎调用例题
全局#include Once "Afx/AfxSapi.bi"
Const MSG_SAPI_EVENT = WM_USER + 1
' --> change me
Dim Shared pSpVoice As Afx_ISpVoice Ptr
初始
pSpVoice = AfxNewCom("SAPI.SpVoice")
If pSpVoice Then
' // 将感兴趣的对象设置为单词边界
pSpVoice->SetInterest(SPFEI(SPEI_WORD_BOUNDARY), SPFEI(SPEI_WORD_BOUNDARY))
' // 设置将接收MSG_SAPI_EVENT消息的窗口的句柄
pSpVoice->SetNotifyWindowMessage(hWndForm, MSG_SAPI_EVENT, 0, 0)
Else
AfxMsg "你的电脑里没有安装 微软TTS语音引擎"
End If
播放
Dim cws As CWStr = FF_Control_GetText(HWND_FORM1_TEXT1)
If pSpVoice Then
pSpVoice->Speak(cws, SPF_ASYNC, Null)
Else
AfxMsg "你的电脑里没有安装 微软TTS语音引擎"
End If
源码下载:Basic语言编程群 78458582
正需要,支持楼主大人了! 和vb6几乎一样
页:
[1]