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 CoInitialize(nil); as the first statement of your program. Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal