When I run the code below I get:
An unhandled exception occurred at $004143C0:
■ Free Pascal IDE Version 1.0.12 [2022/02/07]
■ Compiler Version 3.3.1-10077-gc8403ad49e
■ GDB Version GNU gdb (GDB) 7.2
Running "i:\programming\sapi.exe "
EOleError: Variant does not reference an automation object
  $004143C0
  $004194DD
  $0040B991
  $0040193B  SPEAK,  line 13 of i:/programmingl/sapi.pas
  $00401962  main,  line 17 of i:/programming/sapi.pas

program voice;
uses
comobj;

procedure speak(s : string);

var
v : olevariant;

begin
v:=CreateOleObject('SAPI.SpVoice');
v.Speak(s);
end;

begin
speak('Hello.');
end.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to