[fpc-pascal] Microsoft SAPI on Freepascal
Michael Van Canneyt
michael at freepascal.org
Mon Jun 26 20:36:37 CEST 2023
On Mon, 26 Jun 2023, Michael Van Canneyt via fpc-pascal wrote:
>
>
> On Mon, 26 Jun 2023, James Richters wrote:
>
>>
>> I tried to make your example into a FPC program without Lazarus:
>> {$mode objfpc}{$H+}
>> uses
>> comobj;
>> var
>> SavedCW: Word;
>> v: OleVariant;
>> begin
>> v:=CreateOleObject('SAPI.SpVoice');
>> v.Speak('Hello');
>> End.
>> I get:
>> Running "i:\programming\gcode\mill\sapi.exe "
>> An unhandled exception occurred at $00414370:
>> EOleError: Variant does not reference an automation object
>> $00414370
>> $0041948D
>> $0040B941
>> $004018DF main, line 9 of i:/programming/gcode/mill/sapi.pas
>
> I suspect COM is not properly initialized, and that Lazarus does this for
> you.
> (it needs com for some components on windows)
>
> So, try adding unit windows to the uses clause and add
That should be unit activex instead of unit windows.
Michael.
More information about the fpc-pascal
mailing list