Consultor Eletrônico



Kbase P168571: Error 5884 (Invalid component-handle) from application using COM object
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/23/2010
Status: Unverified

SYMPTOM(s):

Error 5884 (Invalid component-handle) from application using COM object

Invalid component-handle referenced while processing method/statement: <method or statement name>. <COM message> <program name> (5884)

Invalid component-handle referenced while processing method/statement: PrintOut. Merge_And_Print letters\LetterLib.p (5884)

Progress application that performs the mail merge displays error message about delimiters and shows a dialog to specify field and record delimiters.

Cannot print some letters from Microsoft Word mail merge using COM Automation

FACT(s) (Environment):

Word automation object methods are run NO-ERROR.
Error handling code checks for ERROR-STATUS:ERROR.
ERROR-STATUS:ERROR is not detected by error handler when application is run.
Windows
Progress/OpenEdge Product Family
OpenEdge Category: Language (4GL/ABL)

CAUSE:

One of the data fields in each affected record contained special characters that the Progress application could not process. This caused the creation of the new Word automation object to fail. However, COM errors do not raise ERROR-STATUS:ERROR, although they do add a message that can be retrieved with ERROR-STATUS:GET-MESSAGE(). Because the application only checked ERROR-STATUS:ERROR and not ERROR-STATUS:NUM-MESSAGES, it did not detect the problem until the last method call, which did not have any error handling code. The COM message refers to the fact that the component-handle did not reference a valid object.

FIX:

Check ERROR-STATUS:NUM-MESSAGES as well as ERROR-STATUS:ERROR in error handlers for COM object methods. This will allow the application to detect execution-time problems such as invalid data so they can be handled gracefully.