2008-10-16 5 views
5

다음과 같이 2000/NT/XP에서 Delphi를 사용하여 OLE 객체를 작성하여 만들었습니다.Vista에서 말하기 기능

Voice := CreateOLEObject('SAPI.SpVoice'); 
Voice.speak(...) 

그러나 Vista에서는 작동하지 않습니다. 어떻게하면 내 프로그램이 Vista에서 일부 텍스트를 말할 수 있습니까?

+0

감사합니다. 제안 된 용지의 구성 요소와 작동합니다 (http://www.blong.com/Conferences/DCon2002/Speech/SAPI51/SAPI51.htm) –

답변

4

다음 코드를 사용하여 (Vista Home Premium의 D2009) 시도해 보았습니다. 그것이 EZeroDivide을 비스타에서 작동 및 제공되지 않는 이유를 들어

:

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. 

참고로, 브라이언 롱에 의해 nice paper on using speech in Delphi programming ...


(매우) 늦은 업데이트가 IDE 외부의 예외는이 다른 질문을 참조하십시오. Delphi SAPI Text-To-Speech

+0

용지를 보내 주셔서 감사합니다. 그러나, 당신이 보여준 코드를 실행하면 Vista에서 "0으로 부동 소수점 나누기"오류가 발생합니다. Vista에서 테스트 해 보셨습니까? (필자는 Windows XP에서 BDS2006을 구축하고 Vista에서 실행 파일을 실행했습니다.) –

+0

Vista에서 (동일한 시스템에서) 빌드하고 테스트했습니다. –

+0

감사합니다. François. 그것은 당신이 제안한 종이의 구성 요소와 함께 작동합니다 (http://www.blong.com/Conferences/DCon2002/Speech/SAPI51/SAPI51.htm) –