C
Chris Hinton
I am running into an issue with the GetSpellingSuggestions method. If I call
it without specifying a custom dictionary, the call works find and returns a
list of words as expected. However, if I provide the path to a custom
dictionary it fails with an HR of 0x800a239d (which I can find no reference
to anywhere).
Here is the code that displays the error... If I make the 'dictionary'
variant vtMissing, the GetSpellingSuggestions works perfectly. Anybody have
any suggestions (pun intented)...
STDMETHODIMP CSpellChecker::GetSpellingSuggestions
(
BSTR word,
BSTR customDictionary,
ISpellingSuggestions **suggestions
){
HRESULT returnValue;
MSWord::_ApplicationPtr spellChecker = _Module.getMSWordApplication();
if( NULL == spellChecker )
{
returnValue = E_UNEXPECTED;
}
else if( NULL == word ||
NULL == suggestions )
{
returnValue = E_POINTER;
}
else
{
try
{
_variant_t ignoreUppercase( m_ignoreUppercase );
_variant_t dictionary = validateCustomDictionary(
customDictionary ) ? _variant_t(customDictionary) : vtMissing;
MSWord::SpellingSuggestionsPtr sug =
spellChecker->GetSpellingSuggestions( word, &dictionary, &ignoreUppercase );
CSpellingSuggestions * cSug = new CComObject<CSpellingSuggestions>;
cSug->SetSuggestions( sug );
*suggestions = cSug;
(*suggestions)->AddRef();
returnValue = S_OK;
}
catch( const _com_error & e )
{
_bstr_t message( e.ErrorMessage() );
_bstr_t desc( e.Description() );
OutputDebugString( e.ErrorMessage() );
OutputDebugString( "\n" );
returnValue = E_FAIL;
}
}
return( returnValue );
}
it without specifying a custom dictionary, the call works find and returns a
list of words as expected. However, if I provide the path to a custom
dictionary it fails with an HR of 0x800a239d (which I can find no reference
to anywhere).
Here is the code that displays the error... If I make the 'dictionary'
variant vtMissing, the GetSpellingSuggestions works perfectly. Anybody have
any suggestions (pun intented)...
STDMETHODIMP CSpellChecker::GetSpellingSuggestions
(
BSTR word,
BSTR customDictionary,
ISpellingSuggestions **suggestions
){
HRESULT returnValue;
MSWord::_ApplicationPtr spellChecker = _Module.getMSWordApplication();
if( NULL == spellChecker )
{
returnValue = E_UNEXPECTED;
}
else if( NULL == word ||
NULL == suggestions )
{
returnValue = E_POINTER;
}
else
{
try
{
_variant_t ignoreUppercase( m_ignoreUppercase );
_variant_t dictionary = validateCustomDictionary(
customDictionary ) ? _variant_t(customDictionary) : vtMissing;
MSWord::SpellingSuggestionsPtr sug =
spellChecker->GetSpellingSuggestions( word, &dictionary, &ignoreUppercase );
CSpellingSuggestions * cSug = new CComObject<CSpellingSuggestions>;
cSug->SetSuggestions( sug );
*suggestions = cSug;
(*suggestions)->AddRef();
returnValue = S_OK;
}
catch( const _com_error & e )
{
_bstr_t message( e.ErrorMessage() );
_bstr_t desc( e.Description() );
OutputDebugString( e.ErrorMessage() );
OutputDebugString( "\n" );
returnValue = E_FAIL;
}
}
return( returnValue );
}