当我使用GetVoices方法时,出现错误“ System.Runtime.InteropServices.COMException:'来自HRESULT的异常:0x80045039'”
我的代码:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim SAPI
SAPI = CreateObject("SAPI.SPVoice")
SAPI.voice = SAPI.GetVoices.Item(0)
SAPI.Speak("hello world)
End Sub
删除以下行时,代码可以正常工作:
API.voice = SAPI.GetVoices.Item(0)
我试图以管理员身份运行Visual Studio,但仍然出现此错误。