[Delphi]Sapi i Ole error


(system) #1

Witam. Odpowiedzi na moje pytanie nie było w google. Otóż zainstalowałem SAPI na delphi, i pisząć program na wzór tego tutaj

unit Unit1;


interface


uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, OleServer, SpeechLib_TLB, StdCtrls, ActiveX, ComCtrls, OleCtnrs;


type

  TForm1 = class(TForm)

    SpSharedRecoContext1: TSpSharedRecoContext;

    Memo1: TMemo;

    procedure FormCreate(Sender: TObject);

    procedure SpSharedRecoContext1Recognition(ASender: TObject;

      StreamNumber: Integer; StreamPosition: OleVariant;

      RecognitionType: TOleEnum; const Result: ISpeechRecoResult);

    procedure SpSharedRecoContext1Hypothesis(ASender: TObject;

      StreamNumber: Integer; StreamPosition: OleVariant;

      const Result: ISpeechRecoResult);

  private

  fMyGrammar : ISpeechRecoGrammar;

    { Private declarations }

  public

    { Public declarations }

  end;


var

  Form1: TForm1;


implementation


{$R *.dfm}


procedure TForm1.FormCreate(Sender: TObject);

begin

fMyGrammar := SpSharedRecoContext1.CreateGrammar(0);

  fMyGrammar.DictationSetState(SGDSActive);

end;


procedure TForm1.SpSharedRecoContext1Recognition(ASender: TObject;

  StreamNumber: Integer; StreamPosition: OleVariant;

  RecognitionType: TOleEnum; const Result: ISpeechRecoResult);

begin

Memo1.Text := Result.PhraseInfo.GetText(0,-1,true);

end;


procedure TForm1.SpSharedRecoContext1Hypothesis(ASender: TObject;

  StreamNumber: Integer; StreamPosition: OleVariant;

  const Result: ISpeechRecoResult);

begin

Memo1.Text := Result.PhraseInfo.GetText(0,-1,true);

end;


end.

I nie wiem czemu wywala mi błąd OLE error 80045077 zaznaczając linijkę fMyGrammar := SpSharedRecoContext1.CreateGrammar(0);

Kompletnie nie wiem o co chodzi. Proszę o szybką pomoc, jeśli to oczywiście możliwe. Z góry dziękuję :slight_smile: