[fpc-pascal] Microsoft SAPI on Freepascal

tsiegel at softcon.com tsiegel at softcon.com
Mon Jun 26 17:26:45 CEST 2023


Thank you, this one works for me with a command line compile.  I 
compared the two programs, and the line that asks for the voices is the 
culprit.

I'll have to do some digging to see why that line breaks the runtime 
execution.

But at least I can make it work now.  I'd always used powerbasic when I 
needed to work with com objects, good to know I can do the same thing in 
fpc now.


On 6/26/2023 2:12 PM, Rik van Kekem via fpc-pascal wrote:
> 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
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list