delphi - Text to speech in Vista -


i did creating ole object delphi in 2000/nt/xp following:

voice := createoleobject('sapi.spvoice'); voice.speak(...) 

but not work in vista, how can make program speak text in vista?

i tried (d2009 on vista home premium) following code , works!

unit unit1;  interface  uses   windows, messages, sysutils, variants, classes, graphics, controls, forms,   dialogs, stdctrls, comobj;  type   tform1 = class(tform)     button1: tbutton;     procedure button1click(sender: tobject);   private     { private declarations }   public     { public declarations }   end;  var   form1: tform1;  implementation  {$r *.dfm}  procedure tform1.button1click(sender: tobject); var   voice: variant; begin   voice := createoleobject('sapi.spvoice');   voice.speak('hello world'); end;  end. 

fyi, there nice paper on using speech in delphi programming brian long...


(very) late update:

for why might not work in vista , give ezerodivide exception outside ide, see other question: delphi sapi text-to-speech


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -