Article View: borland.public.cppbuilder.nativeapi
Article #1193SAPI Failure under Vista - Help!
From: JohnC
Date: Sat, 20 Oct 2007 14:53
Date: Sat, 20 Oct 2007 14:53
60 lines
2442 bytes
2442 bytes
Well, I wasn't sure what the best group was for this question, but here
goes.
The following object works perfectly under XP:
class TJMCSpeech
{
public:
TJMCSpeech(); //Constructor
~TJMCSpeech(); //Destructor
void Speak(String Words); //Speak the input words in the string.
private:
HRESULT hr;
ISpVoice* pVoice;
};
//-------------------
//Constructor
TJMCSpeech::TJMCSpeech()
{
hr = S_OK;
pVoice = NULL;
::CoInitialize(NULL);
//Create a SAPI voice:
hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice,
(void**)&pVoice);
}
//Destructor
TJMCSpeech::~TJMCSpeech()
{
if(SUCCEEDED(hr))
pVoice->Release();
::CoUninitialize();
}
//---------------------------------------------------------------------------
void TJMCSpeech::Speak(String Words)
{
if(SUCCEEDED(hr))
pVoice->Speak(L"Hello World",SPF_DEFAULT,NULL);
}
//--------------------------
For the sake of this example, I've replaced the use of "Words" in the call
to Speak() by a fixed string, just to avoid any discussion about how I'm
converting the String to a BSTR.
Simple right?
However, when I run it under Vista I get a floating point divide by zero
when Speak() is called.
I've checked all pointers and as far as I can tell, they are non-NULL when
used and hr indicates a successful creation.
I'm at a loss since I'm not able to upgrade to BDS 2008 at this time (I'm
using BDS 2007).
Thanks for any help,
John
Technical Details
Message-ID:
<471a1686@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6c3b668ca80ad7d9,start X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "JohnC" <jcibulskis@sbcglobal.net> Newsgroups: borland.public.cppbuilder.nativeapi Subject: SAPI Failure under Vista - Help! Date: Sat, 20 Oct 2007 09:53:45 -0500 Lines: 63 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 NNTP-Posting-Host: 76.223.245.175 Message-ID: <471a1686@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1192892038 76.223.245.175 (20 Oct 2007 07:53:58 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail