[fpc-pascal] Microsoft SAPI on Freepascal

James Richters james.richters at productionautomation.net
Tue Jun 27 01:15:17 CEST 2023


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.



More information about the fpc-pascal mailing list