I am using the Word feature in Labwindows to create test report
documents at the end of a functional test cycle. At the end of the
function that I call to create the report, just before it returns to
the calling routine, Labwindows stops in the "WordRpt_DocumentSaveAs"
function that I called, very similar to a breakpoint (which I didnt
set). I can hit the continue button and it finishes creating and
saving the Word report. I found that if I comment out the following
line in the "WordRpt_DocumentSaveAs" function, it doesnt stop (see
below), but I
have trouble opening the newly created Word document unless I wait a
while or exit the Labwindows program. This only occurs when I run the
program by clicking on the green debug project arrow in the GUI
toolbar. This issue doensnt occur when I create a debug or release
executable! So it is not really a problem, as the document gets
created in either case. I was just wondering if anyone else has run
across this behavior and if so, have they found a way to resolve it?
My code snippet of the call to save the Word document:
// save the report and close the application
WordRpt_DocumentSaveAs (gDocHandle, fileName); // save the
document
WordRpt_ApplicationQuit (gAppHandle,
WRConst_DoNotSaveChanges); //
close the application
return 0;
Code snippet of the "WordRpt_DocumentSaveAs" function (located in the
WordReport.c module) showing the "CA_VariantClear (&vtfileName)" line
of code, where Labwindows stops, very similar to setting a
breakpoint. :
HRESULT CVIFUNC WordRpt_DocumentSaveAs(CAObjHandle docHandle,
char
fileName[MAX_PATHNAME_LEN])
{
HRESULT error = S_OK;
VARIANT vtfileName;
CA_VariantSetEmpty (&vtfileName);
errChk (CA_VariantSetCString (&vtfileName, fileName));
errChk(Word_DocumentSaveAs (docHandle, NULL, vtfileName,
CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL));
Error:
// CA_VariantClear (&vtfileName); (THIS IS WHERE THE PROGRAM
STOPS, BUT DOESNT STOP WITH
THIS LINE
COMMENTED OUT)
return error;
}
Thanks for any comments regarding this behavior.