Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages
Started by JohnC
Sat, 20 Oct 2007 14:53
SAPI Failure under Vista - Help!
Author: 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
Re: SAPI Failure under Vista - Help!
Author: Darko Miletic
Date: Sat, 20 Oct 2007 19:27
Date: Sat, 20 Oct 2007 19:27
19 lines
1620 bytes
1620 bytes
JohnC wrote: > Well, I wasn't sure what the best group was for this question, but here > goes. > > However, when I run it under Vista I get a floating point divide by zero > when Speak() is called. First of all try to mask floating point exceptions : http://homepages.borland.com/ccalvert/TechPapers/FloatingPoint.html Second, try to initialize COM like this: CoInitializeEx (NULL, COINIT_MULTITHREADED) Than check the result of the Speak function after that and tell us the results of that experiment.
Re: SAPI Failure under Vista - Help!
Author: JohnC
Date: Sat, 20 Oct 2007 23:47
Date: Sat, 20 Oct 2007 23:47
20 lines
1557 bytes
1557 bytes
> First of all try to mask floating point exceptions : > > http://homepages.borland.com/ccalvert/TechPapers/FloatingPoint.html > Darko: Great! I masked the floating point exceptions and it now works fine! I will restrain myself and not say anything about a software company that masks floating point exceptions in order to give the impression that its software is working correctly. I've programmed numerical software for 40 years and never had to resort to such nonsense. Do you think that it is worth trying the other initialization that you mentioned to see if that would cure the problem without the masking? Thanks again, John
Re: SAPI Failure under Vista - Help!
Author: Darko Miletic
Date: Sun, 21 Oct 2007 01:08
Date: Sun, 21 Oct 2007 01:08
22 lines
1933 bytes
1933 bytes
JohnC wrote: >> First of all try to mask floating point exceptions : >> >> http://homepages.borland.com/ccalvert/TechPapers/FloatingPoint.html >> > Darko: > > Great! > I masked the floating point exceptions and it now works fine! > I'm glad it worked. The floating point issues are rather common with borland compilers. Microsoft masks almost all fp excpetions by default and that is why most of things just work with their compiler. To be on the safe side you should just do the same. > Do you think that it is worth trying the other initialization that you > mentioned to see if that would cure the problem without the masking? You can try but I think in this case it is probably vista related problem. Darko
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads