In my program I use a Google voice for text to speech by using an URL. But if my text is too long for Google, my program throws an
AccessViolationException. This is the message it gives me:
Attempted to read or write protected memory. This indicates that there are often other memory is corrupted.
I've also search on the MSDN site.
But my problem is now, I've try to solve my problem by using exception handling, but he throw the
AccessViolationException again and again... I've also seen if I debug my program, that he throw it at the end of a method. (I'm using C# in a WPF application)
Can anyone help me? Thanks.
Best How To :
For this moment I've to solve it to use this code:
string textToRead = new TextRange(rtbTextEditor.Document.ContentStart,rtbTextEditor.Document.ContentEnd).Text.Trim();
if (textToRead.Length < 100)
wbbWebBrowser.Navigate("http://translate.google.com/translate_tts?tl=nl&q=" + textToRead);
catch (AccessViolationException ex)
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("The text is to long to read by the Google voice", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
I think Google can only speech a text is smaller then 100 characters. Now I haven't