Lazarus

Using the Lazarus IDE => General => Topic started by: misabov on April 10, 2017, 12:57:11 pm

Title: SpVoice.GetVoices returned exception class EOleSysError
Post by: misabov on April 10, 2017, 12:57:11 pm
Hi!
The project has generated an exception class EOleSysError with a message: ???? ?????? ?? ??????.

uses
...,ComObj;

var
SpVoice: Variant;

SpVoice := CreateOleObject('SAPI.SpVoice');
SpVoice.Voice:= SpVoice.GetVoices('','').Item(0);

SpVoice GetVoices method (SAPI 5.3) cannot return  a selection of voices available to the voice.
Title: Re: SpVoice.GetVoices returned exception class EOleSysError
Post by: ASerge on April 12, 2017, 10:01:31 pm
Cast to IDispatch:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. var
  3.   SpVoice, Voices, Voice: OleVariant;
  4. begin
  5.   SpVoice := CreateOleObject('SAPI.SPVoice');
  6.   Voices := SpVoice.GetVoices;
  7.   Voice := Voices.Item(0);
  8.   Caption := string(Voice.GetDescription);
  9.   SpVoice.Voice := IDispatch(Voice); // := Voice not work
  10. end;
Title: Re: SpVoice.GetVoices returned exception class EOleSysError
Post by: misabov on April 17, 2017, 02:05:57 am
 :) ASerge Thank you very much. That's what I was looking for
TinyPortal © 2005-2018