Getting Access Denied Error trying to use speak using spVoice object in VB.NET RRS feed

  • Question

  • I have the following simple code. It fails when trying to call the "speak" method.  

    Imports System.Globalization Imports SpeechLib Public Class Form1

    Public WithEvents Voice As SpVoice = Nothing

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If Voice Is Nothing Then Voice = New SpVoice Voice.Speak("I can speak", SpeechVoiceSpeakFlags.SVSFlagsAsync) End Sub End Class

    When I run the program and click the button, I get System.Interop.COMexception  Exception from HRESULT: 0x8004503A. I am NOT running this as ASP.NET, which is the only help I can find, this is a simple Windows Forms application. I was getting access denied and then changed this to an x86 only project and now get this error. 

    • Edited by fndecker Wednesday, April 26, 2017 7:27 PM
    Wednesday, April 26, 2017 7:24 PM

All replies

  • Well, very interesting. As if things aren't complicated enough with at least 3 different libraries for Speech from Microsoft. My issue was that I initially tried to get Microsoft.Speech working and could not because no one seems to know how to link the audio stream from any audio input device to the speech recognition engine. I know how to do this easily with SAPI, so gave up and started to write the application to Speechlib (SAPI 5.4).  Despite removing the speech SDK v11 from my references in the solution explorer and reverencing the 5.4 Microsoft speech object, it still had v11 in there hidden. I found it by going to the project options and checking the references there. Once I deleted it, I could then add the reference again to Microsoft Speech Objects v5.4 (the second one to SAPI.DLL. I still haven't found out what the other one to sapi_onecore.dll is). When I ran the program again, it worked.
    • Edited by fndecker Monday, July 3, 2017 2:02 PM
    Wednesday, April 26, 2017 7:58 PM