Error in Find::Execute() API call. ESP Was not properly saved acro

S

Sreekanth Murthy

Hi there,

There was an error in Find::Execute() API call which is present in one of
our function. The code for the above Find::Execute() API call is as below:

if(m_pWordApp == NULL)
return PILogError("MS Word is not running.", E_FAIL);
// Get the selection object.
MSWORD::SelectionPtr pSelection = m_pWordApp->Selection;
if(pSelection == NULL)
return PILogError("Unable to get the selection object from MS
Word.", E_FAIL);
// Get the find object.
MSWORD::FindPtr pFind = pSelection->Find;
if(pFind == NULL)
return PILogError("Unable to get the find object from the
selection object.", E_FAIL);
// Replace the text.
CComVariant varFind(keyFilter);
CComVariant varWrap(MSWORD::wdFindContinue);
CComVariant varReplaceType(MSWORD::wdReplaceNone);

// Loop through and find all the keys.
while(pFind->Execute( &varFind, //FindText
&vtFalse,
//MatchCase
&vtFalse,
//MatchWholeWord
&vtTrue,
//MatchWildcards
&vtFalse,
//MatchSoundsLike
&vtFalse,
//MatchAllWordForms
&vtTrue,
//Forward
&varWrap,
//Wrap
&vtFalse,
//Format
&vtMissing, //ReplaceWith
&varReplaceType, //Replace
&vtFalse,
//MatchKashida
&vtFalse,
//MatchDiacritics
&vtFalse,
//MatchAlefHamza
&vtFalse
//MatchControl
) == VARIANT_TRUE)
{
....

}


The error message shown in the Messagebox contains:
---------------------------------------------------------------------------------------------
The value of ESP was not properly saved across a function call. This
ususally a result of calling function declared with one calling convention
with a function pointer declared with a different calling convention.
---------------------------------------------------------------------------------------------

With Abort, Retry and Igonre buttons.

I appreciate your help in resolve this issue.

Thanks,
Sreekanth Murthy
 
S

Sreekanth Murthy

Sreekanth Murthy said:
Hi there,

There was an error in Find::Execute() API call which is present in one of
our function. The code for the above Find::Execute() API call is as below:

if(m_pWordApp == NULL)
return PILogError("MS Word is not running.", E_FAIL);
// Get the selection object.
MSWORD::SelectionPtr pSelection = m_pWordApp->Selection;
if(pSelection == NULL)
return PILogError("Unable to get the selection object from MS
Word.", E_FAIL);
// Get the find object.
MSWORD::FindPtr pFind = pSelection->Find;
if(pFind == NULL)
return PILogError("Unable to get the find object from the
selection object.", E_FAIL);
// Replace the text.
CComVariant varFind(keyFilter);
CComVariant varWrap(MSWORD::wdFindContinue);
CComVariant varReplaceType(MSWORD::wdReplaceNone);

// Loop through and find all the keys.
while(pFind->Execute( &varFind, //FindText
&vtFalse,
//MatchCase
&vtFalse,
//MatchWholeWord
&vtTrue,
//MatchWildcards
&vtFalse,
//MatchSoundsLike
&vtFalse,
//MatchAllWordForms
&vtTrue,
//Forward
&varWrap,
//Wrap
&vtFalse,
//Format
&vtMissing, //ReplaceWith
&varReplaceType, //Replace
&vtFalse,
//MatchKashida
&vtFalse,
//MatchDiacritics
&vtFalse,
//MatchAlefHamza
&vtFalse
//MatchControl
) == VARIANT_TRUE)
{
....

}


The error message shown in the Messagebox contains:
---------------------------------------------------------------------------------------------
The value of ESP was not properly saved across a function call. This
ususally a result of calling function declared with one calling convention
with a function pointer declared with a different calling convention.
---------------------------------------------------------------------------------------------

With Abort, Retry and Igonre buttons.

I appreciate your help in resolve this issue.

Thanks,
Sreekanth Murthy
 
C

Cindy M.

Mmm, I don't find any reference to "ESP" in your code, so I
don't know what the error message may be referring to...

There is, however, a common problem when automating Word
using Find, described in this KB article. Perhaps that's
behind it all:
http://support.microsoft.com/kb/292744/EN-US/

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top