[fpc-pascal] Microsoft SAPI on Freepascal

Rik van Kekem rik at graficalc.nl
Mon Jun 26 16:12:06 CEST 2023


Op 25-06-2023 om 22:46 schreef James Richters via fpc-pascal:
> I gave up on doing it directly, it seems SO convoluted to do with FPC 
> with the COM unit and all this stuff I just don’t understand,
> and it’s SO simple to do with a VBS script in just 3 lines and it just 
> works!(it would only be 2 lines if I didn’t want Microsoft Zira)
You didn't mention the version of FPC/Lazarus you were using.

I had a simple example which worked for me (but your example also 
directly worked for me in trunk).

program Project1;
{$mode objfpc}{$H+}
uses
   Classes, ComObj;
var
   Voice: olevariant;
begin
   Voice := CreateOLEObject('SAPI.SpVoice');
   Voice.Speak('I am speaking.', 0);
   Voice.Speak('I am also speaking.', 0);
end.

I didn't even have the problem with any EZeroDivide exception.

-- 
Grtz,
Rik van Kekem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20230626/2656cdfc/attachment.htm>


More information about the fpc-pascal mailing list